This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author holdenweb
Recipients eric.smith, holdenweb, lukasz.langa, michael.foord
Date 2010-11-25.17:54:32
SpamBayes Score 0.00901841
Marked as misclassified No
Message-id <4CEEA2AE.70304@holdenweb.com>
In-reply-to <1290707290.51.0.623270227124.issue10533@psf.upfronthosting.co.za>
Content
On 11/25/2010 11:48 AM, Eric Smith wrote:
> 
> Eric Smith <eric@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/
History
Date User Action Args
2010-11-25 17:54:35holdenwebsetrecipients: + holdenweb, eric.smith, michael.foord, lukasz.langa
2010-11-25 17:54:32holdenweblinkissue10533 messages
2010-11-25 17:54:32holdenwebcreate