[Python-Dev] collections module

Mark Russell marktrussell at btopenworld.com
Sat Jan 10 14:44:48 EST 2004

On Sat, 2004-01-10 at 19:26, Raymond Hettinger wrote:
> Instead of a method, it may be better to use a keyword argument in the
> constructor:
> d = dict(default = lambda k:[])

Unfortunately that has a meaning already:

   >>> d = dict(default = lambda k:[])
   >>> d
   {'default': <function <lambda> at 0x40212ed4>}

A shame, because it does look nicer (OTOH I use and like the keyword
argument dict constructor).

I'd love to have the implicit default functionality though.

Mark Russell

More information about the Python-Dev mailing list