-
-
Notifications
You must be signed in to change notification settings - Fork 50
Open
Description
Consider the following:
from atom.api import Atom, Int, Typed, observe
class Pt(Atom):
x = Int()
y = Int()
class Item(Atom):
pos = Typed(Pt, ())
@observe('pos.x') # adding 'pos' here makes it change
def on_change(self, change):
print(change)
item = Item()
item.pos.x = 1 # This triggers on_change
item.pos = Pt(x=2, y=0) # This does not trigger on_changeWhen running the code above it prints:
{'type': 'create', 'object': <__main__.Pt object at 0x7527f06a6640>, 'name': 'x', 'value': 1}
But it seems like it should probably have also printed an update?
{'type': 'update', 'object': <some new Pt>, 'name': 'x', 'oldvalue': 1, 'value': 2}
I'm not sure if the current behavior is expected or not.
Metadata
Metadata
Assignees
Labels
No labels