Skip to content

Instantly share code, notes, and snippets.

@mastro35
Created November 22, 2017 17:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mastro35/0af4ec3abcf360dfadac9d0c1a047f25 to your computer and use it in GitHub Desktop.
Save mastro35/0af4ec3abcf360dfadac9d0c1a047f25 to your computer and use it in GitHub Desktop.
example for devaraj
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