optimizing large dictionaries

Paul Rubin http
Thu Jan 15 18:38:11 EST 2009


Per Freem <perfreem at yahoo.com> writes:
> 2] is there an easy way to have nested defaultdicts? ie i want to say
> that my_dict = defaultdict(defaultdict(int)) -- to reflect the fact
> that my_dict is a dictionary, whose values are dictionary that map to
> ints. but that syntax is not valid.

my_dict = defaultdict(lambda: defaultdict(int))



More information about the Python-list mailing list