Pete:
> Translate the hexadecimal form
> into decimal and confirm that they match.

No need to convert the IDs...


Soviut:
> You shouldn't have to compare the hex IDs.  Just a simple comparison
> operator will work:
>
> firstPoint = Point()
> secondPoint = Point()
> print(firstPoint == secondPoint)
>
> result: True

Remember about __eq__ and "is":

class Foo:
    def __init__(self, x):
        self.x = x
    def __eq__(self, other):
        return self.x == other.x

f1 = Foo(1)
f2 = Foo(2)
f3 = Foo(2)
f4 = f3
print f1 == f2, f1 is f2 # False False
print f2 == f3, f2 is f3 # True False
print f3 == f4, f3 is f4 # True True

Bye,
bearophile
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to