: Off on a tangent ...
On 16 August 2011 20:14, gc <gc1...@gmail.com> wrote: > > Let me address one smell from my particular example, which may be the > one you're noticing. If I needed fifty parallel collections I would > not use separate variables; I've coded a ghastly defaultdefaultdict > just for this purpose, which effectively permits what most people > would express as defaultdict(defaultdict(list)) [not possible AFAIK > with the existing defaultdict class]. Dunno if it's better than your ghastly defaultdefaultdict, but this works: >>> from collections import defaultdict >>> ddd = defaultdict(lambda: defaultdict(list)) >>> ddd["foo"]["bar"].append("something") >>> ddd["foo"]["bar"] ['something'] >>> -[]z. -- http://mail.python.org/mailman/listinfo/python-list