[Python-Dev] dict.addlist() (original) (raw)
Fred L. Drake, Jr. fdrake at acm.org
Tue Jan 20 13:37:10 EST 2004
- Previous message: [Python-Dev] dict.addlist()
- Next message: [Python-Dev] dict.addlist()
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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. PythonLabs at Zope Corporation
- Previous message: [Python-Dev] dict.addlist()
- Next message: [Python-Dev] dict.addlist()
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]