A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2006-February/061344.html below:

[Python-Dev] Proposal: defaultdict

[Python-Dev] Proposal: defaultdict [Python-Dev] Proposal: defaultdictIlya Sandler ilya at bluefir.net
Sat Feb 18 08:03:42 CET 2006
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
More information about the Python-Dev mailing list

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