pickle function reference ??

T

ted kelly

It seems I can not deepcopy or pickle an object with an attribute that
points to any function that is not a built in.
I thought it should be ok as long as the function is defined in the top
level of a module.
What am I missing??
 
M

Martin v. =?iso-8859-15?q?L=F6wis?=

ted kelly said:
It seems I can not deepcopy or pickle an object with an attribute that
points to any function that is not a built in.

That is not true

import pickle

class A:
pass

a=A()
a.attr=pickle.loads

data=pickle.dumps(a)
b=pickle.loads(data)
print b.attr

works fine for me.

Regards,
Martin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,169
Messages
2,570,920
Members
47,464
Latest member
Bobbylenly

Latest Threads

Top