FixedPoint
Mark McEahern
marklists at mceahern.com
Thu Feb 7 13:02:55 EST 2002
More information about the Python-list mailing list
Thu Feb 7 13:02:55 EST 2002
- Previous message (by thread): FixedPoint
- Next message (by thread): FixedPoint
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
> From: Laura Creighton [mailto:lac at strakt.com]: > I would tell the PyPgSql folks to please change the test so that their > code will work when passed an argument which redefines the __cmp__ > function. Its just something they need to learn -- which Andrew Dalke > taught me hmm, 2 weeks ago now. Of course, consider the code below, which shows (in a perhaps overly simplistic way) that I may not realize I'm comparing to None. Should I handle that? I don't know what the Pythonic way says--maybe it says I should just let the error propagate in this case and trap it. I lean towards thinking I oughta make my __eq__ and the like smarter. // mark #! /usr/bin/env python class foo: def __init__(self, value): self.value = value def __eq__(self, other): return self.value == other.value def __ne__(self, other): return not (self == other) f = foo(1) g = foo(1) print (f == g) print (f != g) f = None print (f == g) print (f != g)
- Previous message (by thread): FixedPoint
- Next message (by thread): FixedPoint
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list