Advertisement
Guest User

Untitled

a guest
Jul 1st, 2013
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.55 KB | None | 0 0
  1. For object in objects:
  2.   # object.id is the Pyrel-generated ID, safe to serialize.
  3.   idToPyrelId[id(object)] = object.id
  4.  
  5. ...
  6.  
  7. # Later will want to examine e.g.
  8. # <bound method Foo.foo of <__main__.Foo instance at 0x1004a74d0>>
  9. # and look up 0x1004a74d0 to get the object's Pyrel-generated ID
  10. for key, value in thingSerialization.iteritems():
  11.   if key looks like a function pointer:
  12.     get the Python ID of the object
  13.     get the name of the function
  14.     replace key with (idToPyrelId[object ID], function name)
  15.   ditto for value
  16.   recurse as needed
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement