On Sat, 18 Dec 2004 12:40:04 -0600, Mike Meyer <[EMAIL PROTECTED]> wrote: >"John Roth" <[EMAIL PROTECTED]> writes: > > > "Mike Meyer" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > >> PEP: XXX > >> Title: A rational number module for Python > >> The ``Rational`` class shall define all the standard mathematical > >> operations: addition, subtraction, multiplication, division, modulo > >> and power. It will also provide the methods: > >> > >> - max(*args): return the largest of a list of numbers and self. > >> - min(*args): return the smallest of a list of numbers and self. > > > > max() and min() are already part of the standard library. > > Providing them as instance methods is quite irregular. > > They don't handle decimals or rationals. This is following the lead of > the decimal package.
They do handle decimals. They handle any object which define __cmp__, or the appropriate rich comparison methods. The Decimal type seems to define min and max so that NaNs can be treated specially, but I glean this understanding from only a moment of reading decimal.py. Perhaps someone more well informed can declare definitively the purpose of these methods. Also, note that the signatures are not Decimal.max(*args) and Decimal.min(*args), but rather each takes a single decimal argument in addition to self and an optional context argument. So if the goal is symmetry with the Decimal type, then Rational.max() and Rational.min() should take only one argument. Jp -- http://mail.python.org/mailman/listinfo/python-list