"""
So I wanted to test "handedness" in Python, around operators,
by equating two different instances, each of different parentage.
One sees they're the same, the other begs to differ.

IDLE 1.1
>>> from identitycheck import testit
>>> testit()
a == b?  False
b == a?  True

Original context:  a thread on the Math Forum:
http://mathforum.org/kb/message.jspa?messageID=4866533&tstart=0

>>>

"""

class A:
    """
    Begs to differ
    """

    def __eq__(self, other):
        return False

class B:
    """
    I see we're the same
    """

    def __eq__(self, other):
        return True


def testit():

    a = A()
    b = B()
    print "a == b? ", a==b

    print "b == a? ", b==a

if __name__ == "__main__":
    testit()
_______________________________________________
Edu-sig mailing list
[email protected]
http://mail.python.org/mailman/listinfo/edu-sig

Reply via email to