Created
November 22, 2017 17:51
-
-
Save mastro35/0af4ec3abcf360dfadac9d0c1a047f25 to your computer and use it in GitHub Desktop.
example for devaraj
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 | |
class A: | |
def __init__(self): | |
pass | |
class C: | |
def __init__(self): | |
print("deva") | |
pass | |
def a(self): | |
print("yeah!") | |
pass | |
class B: | |
def __init__(self): | |
self.b = A.C() | |
self.b1=1 | |
b = B() | |
print ("ok, object created") | |
my_pickled_b = pickle.dumps(b) | |
print ("ok, object pickled, here it is...") | |
print (my_pickled_b) | |
print ("trying to unpickle it ...") | |
c = pickle.loads(my_pickled_b) | |
print ("unpickled! here it is:") | |
print (c) | |
print ("and this is the value of c.b1 : ") | |
print (c.b1) | |
c.b.a() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment