Created
June 16, 2012 08:54
-
-
Save tomotaka/2940574 to your computer and use it in GitHub Desktop.
callable can be pickled
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pickle | |
def hoge(n): | |
n2 = n * 2 | |
print "this is hoge, n*2=%d" % n2 | |
s_hoge = pickle.dumps(hoge) | |
loaded_hoge = pickle.loads(s_hoge) | |
loaded_hoge(1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment