FixedPoint
Jason Orendorff
jason at jorendorff.com
Sun Feb 10 22:51:34 EST 2002
Mark McEahern wrote:
> [Jason Orendorff]
> > How about:
> >
> > def __cmp__(self, other):
> > try:
> > xn, yn, p = _norm(self, other)
> > return cmp(xn, yn)
> > except:
> > return cmp(float(self), other)
>
> I like that! Would it be better style to trap only the specific error I
> know about?
Yep. If you know what's in _norm() you can do better than I
can. :) Also, you might pull the first return statement out
of the try.
## Jason Orendorff http://www.jorendorff.com/
More information about the Python-list
mailing list