On 4/25/07, Guido van Rossum <[EMAIL PROTECTED]> wrote: > Jeffrey, is there any way you can drop the top of the tree and going > straight from Number to Complex -> Real -> Rational -> Integer? These > are the things that everyone with high school math will know.
I think yes, if you can confirm that the import numbers class Ring(AdditiveGroup): ... numbers.Complex.__bases__ = (Ring,) + numbers.Complex.__bases__ hack I mention under IntegralDomain will make isinstance(int, Ring) return True. Do you want "Number" to be equivalent to Ring+Hashable (or a Haskell-like Ring+Hashable+__abs__+__str__)? I don't think a "Number" class is strictly necessary since people can check for Complex or Real directly, and one of those two is probably what they'll expect after knowing that something's a number. Also, I don't see much point in putting Rational between Real and Integer. The current hierarchy is Real (int, float, Decimal, rational) :> Integer (int) and Real :> FractionalReal (float, Decimal, rational), but Integer and FractionalReal are just siblings. I'm wondering how many people are writing new numeric types who don't know the abstract algebra. I think we should be able to insulate people who are just using the types from the complexities underneath, and the people writing new types will benefit. Or will seeing "Ring" in a list of superclasses be enough to confuse people? -- Namasté, Jeffrey Yasskin _______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com