Created
November 14, 2013 15:48
-
-
Save nikicat/7469093 to your computer and use it in GitHub Desktop.
pickle pypy3
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 f1(): | |
def f2(a): | |
print(a*a) | |
return f2 | |
with open('f2.pickle', 'w+') as f: | |
f.write(pickle.dumps(f1())) | |
******************** | |
import pickle | |
pickle.load(open('f2.pickle'))(2) | |
>> 4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment