Thanks.  I presume this will work for my nested example as well.  Thanks again.

On Thu, Jul 29, 2010 at 2:18 PM, Paul Rubin <no.em...@nospam.invalid> wrote:
> wheres pythonmonks <wherespythonmo...@gmail.com> writes:
>> How do I build an "int1" type that has a default value of 1?
>> [Hopefully no speed penalty.]
>> I am thinking about applications with collections.defaultdict.
>
> You can supply an arbitary function to collections.defaultdict.
> It doesn't have to be a class.  E.g.
>
>    d = collections.defaultdict(lambda: 1)
>
> will do what you are asking.
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to