writing pickle function

perfreem at gmail.com perfreem at gmail.com
Fri Jan 23 15:48:22 CET 2009


hello,

i am using nested defaultdict from collections and i would like to
write it as a pickle object to a file. when i try:

from collections import defaultdict
x = defaultdict(lambda: defaultdict(list))

and then try to write to a pickle file, it says:

TypeError: can't pickle function objects

is there a way around this? it's simply a dictionary that i want to
write to file.. this works no problems with ordinary dicts.

thank you.



More information about the Python-list mailing list