Persistence hooks for copying locations
See locationCopy above.
We get initialized with an initial location:
>>> o1 = Location() >>> persistent = CopyPersistent(o1)
We provide an id function that returns None when given a non-location:
>>> persistent.id(42)
Or when given a location that is inside the initial location:
>>> persistent.id(o1) >>> o2 = Location(); o2.__parent__ = o1 >>> persistent.id(o2)
But, if we get a location outside the original location, we assign it an id and return the id:
>>> o3 = Location() >>> id3 = persistent.id(o3) >>> id3 is None 0 >>> o4 = Location() >>> id4 = persistent.id(o4) >>> id4 is None 0 >>> id4 is id3 0
If we ask for the id of an outside location more than once, we always get the same id back:
>> persistent.id(o4) == id4 1
We also provide a load function that returns the objects for which we were given ids:
>>> persistent.load(id3) is o3 1 >>> persistent.load(id4) is o4 1
There are no implemented interfaces.
There are no attributes in this class.
id(object)
There are no known subclasses.