Closed jonpry closed 1 month ago
Unfortunately, I believe above information is lost by the time the message is received.
If you run,
import pkl
from pkl import Parser
from pprint import pprint
class NewParser(Parser):
def parse(self, obj):
pprint(obj)
pkl.load("./tmp.pkl", parser=NewParser())
output (msgapi output):
[1,
'tmp',
'file:///home/jwyang/dev/pkl-python/tmp.pkl',
[[16,
'node',
[1,
'tmp#Node',
'file:///home/jwyang/dev/pkl-python/tmp.pkl',
[[16, 'name', 'Hello']]]],
[16,
'foo1',
[1,
'tmp#Foo',
'file:///home/jwyang/dev/pkl-python/tmp.pkl',
[[16,
'ref',
[1,
'tmp#Node',
'file:///home/jwyang/dev/pkl-python/tmp.pkl',
[[16, 'name', 'Hello']]]]]]],
[16,
'foo2',
[1,
'tmp#Foo',
'file:///home/jwyang/dev/pkl-python/tmp.pkl',
[[16,
'ref',
[1,
'tmp#Node',
'file:///home/jwyang/dev/pkl-python/tmp.pkl',
[[16, 'name', 'Hello']]]]]]]]]
You can try different methods, such as
Node
If I create multiple references to the same instance in pkl, such as:
I find that this property is not preserved in python. pkl.foo1.ref == pkl.foo2.ref because of elementwise comparison in python. But if I pkl.foo1.ref = "New" then pkl.foo1.ref != pkl.foo2.ref
I am constructing complex graphs in pkl. Being able to check that these references are equal is very useful. Is there a way to add this feature or is this information already lost in the message passing API?