I've wanted something like that in Python at different times... thanks!
edit: Ha! The Wiki article even has basically the same code:
def hash(): return defaultdict(hash)
Python's auto-vivification doens't allow Perl's hap hazard auto-vivification. Perl allows you to say:
my $foo = {}; $foo->{'blah'}[0]->{'bar'}++;
I don't think this can be done for a generalized case in Python. Whether I want is a totally different question.
i wonder whether it will be made part of more languages as JSON-esque nested objects proliferate in our code and minds.
I've wanted something like that in Python at different times... thanks!
edit: Ha! The Wiki article even has basically the same code:
def hash(): return defaultdict(hash)