On Fri, 17 Feb 2006, Phillip J. Eby wrote: > > d = {} # or dict() > > d.default_factory = list > > Why not a classmethod constructor: > > d = dict.with_factory(list) > > But I'd rather set the default and create the > dictionary in one operation, since when reading it as two, you first think > 'd is a dictionary', and then 'oh, but it has a default factory', as > opposed to "d is a dict with a factory" in one thought. Also, class method would mean less typing (esp if dictionary name happens to be longer than a couple of characters ;-) But I'd like to suggest a different name: d = dict.with_default( list) Ilya
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