DanielSank / observed

Observer pattern in python
MIT License
33 stars 4 forks source link

Equality check returns False #6

Closed coldfix closed 10 years ago

coldfix commented 10 years ago

Hey Daniel,

first of all, great work;). I didn't inspect this branch in much detail yet, but I like the splitting of functionality into separate functions (observable_method vs. observable_function).

I found another issue (which again, I found first in obsub, so I didn't need to look too hard):

Many users will expect the comparison operator of the method proxy objects to be equal for the same instance (at least I do):

from observed import observable_method

class Foo(object):

    @observable_method
    def foo(self):
        pass

print(Foo.foo == Foo.foo) # False
foo = Foo()
print(foo.foo == foo.foo) # False :(

Best regards, Thomas

DanielSank commented 10 years ago

Fixed in dedicated-classes branch.

Thomas,

You are awesome. Thanks much for your continued guidance and attention. Your advice about using polymorphism instead of parametrization was a big step forward in my coding skill.

Daniel

coldfix commented 10 years ago

Thanks :) I'm glad, you found this helpful.