Raymond Hettinger writes: > After all the discussions, the best solution to the defaulting problem > appears to be some variant of Martin's general purpose approach: > > d = {} > d.setfactory(list) > for k, v in myitems: > d[k].append(v) # dict of lists Oooh, this could get scary: L = [] L.setfactory(MyClassWithCostlyConstructor) L[0] ;-) -Fred -- Fred L. Drake, Jr. <fdrake at acm.org> PythonLabs at Zope Corporation
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4