Re: [Edu-sig] testing identitycheck.py
30 Jun
2006
30 Jun
'06
11:38 p.m.
""" 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()
6761
Age (days ago)
6761
Last active (days ago)
0 comments
1 participants
participants (1)
-
kirby urner