Last active
January 4, 2016 16:29
-
-
Save MatthieuDartiailh/8647844 to your computer and use it in GitHub Desktop.
Atom issue 53
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from atom.api import Atom, Float | |
class Test(Atom): | |
a = b = Float(0) | |
def _post_setattr_a(x, y, z): | |
print 'a' | |
def _post_setattr_b(x, y, z): | |
print 'b' | |
# Attempting to initilize Test with values | |
t = Test(a = 15, b = 16) | |
print t.a, t.b # print 16 both times | |
print t.get_member('a').get_slot(t), t.get_member('b').get_slot(t) # print 16 and None | |
# Demonstrating the different behaviours between using __set__ and get_member | |
t.__setattr__.__call__('b', 21) # _post_setattr_a is called | |
t.get_member('b').do_setattr(t, 42) # _post_setattr_b is called | |
print t.a, t.b # print 21 both times | |
print t.get_member('a').get_slot(t), t.get_member('b').get_slot(t) # print 21 and 42 | |
#Here the problem seems to be that the wrapped __setattr__ does not access to | |
#the right member. Direct access to the member works fine. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment