On Tue, 30 Aug 2005 18:14:55 +0200, Tim Peters <tim.peters at gmail.com> wrote: >>>> d = {} >>>> d.setdefault(666) >>>> d > {666: None} > > just doesn't seem useful. In fact, it's so silly that someone calling > setdefault with just one arg seems far more likely to have a bug in > their code than to get an outcome they actually wanted. Haven't found reminds me of dict.get()... i think in both cases being explicit:: beast = d.setdefault( 666, None ) beast = d.get( 666, None ) just reads better, allthemore since at least in my code what comes next is invariably a test 'if beast is None:...'. so beast = d.setdefault( 666 ) if beast is None: ... and beast = d.get( 666 ) if beast is None: ... a shorter but a tad too implicit for my feeling. _wolf
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4