Steve Holden <st...@holdenweb.com> added the comment:

On 11/25/2010 11:48 AM, Eric Smith wrote:
> 
> Eric Smith <e...@trueblade.com> added the comment:
> 
> How about:
> 
> from collections import defaultdict
> 
> class defaultdict_value(defaultdict):
>     def __init__(self, value):
>         defaultdict.__init__(self, lambda : value)
> 
> x = defaultdict_value(3)
> print(x[1])
> 
> ----------

+1

But I'd call it defaultdict_const().

regards
 Steve
-- 
Steve Holden           +1 571 484 6266   +1 800 494 3119
PyCon 2011 Atlanta March 9-17       http://us.pycon.org/
See Python Video!       http://python.mirocommunity.org/
Holden Web LLC                 http://www.holdenweb.com/

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue10533>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to