Closed s-cork closed 2 years ago
I'm out of time for today so haven't got an MWE, but when I quickly tried this, I get an attribute error for any method decorated with action
- it no longer exists on the atom.
Now tested - turns out you can add attributes to functions but not methods.
functions have their own __dict__
but methods don't - who knew.
>>> class A:
... def foo(): pass
...
>>> a = A()
>>> a.foo.__dict__ is A.foo.__dict__
True
>>> A.foo.bar = 1
>>> a.foo.eggs = 2
AttributeError
Every day is a school day!
We could do something where the
action
is the thing that gets passed to thewith ActionContext
rather thanself.f
(on line 71 in the new world - line 54 in the old world)that might be nicer But since we already passed the function I didn't change that
feel free to tag a commit onto this one to make that happen and or make it work - this pr is untested