def loads(string): if type(string) in (int, long): return string if type(string) in (str, unicode): return string.encode('ascii') return pickle.loads(str(string))
property = data def test(self): return "hi, i'm %x"% id(self) def dosomething(self): print self.property class junk2: def test(self): return 'ok' property = {'name' : 1} a = junk s = fu.dumps(a) b = fu.loads(s) _a = a() _b = b() print a,_a.test(),_a.property print b,_b.test(),_b.property print a is b def test(x): def closure(): print 'hello', x return closure f = test('computer')
def loads(string): if type(string) in (int,long): return string if type(string) in (str,unicode): return string.encode('ascii') return pickle.loads(str(string))