wishlist Python3K: subclass ints

Aahz Maruch aahz at netcom.com
Thu Jun 8 22:35:27 EDT 2000


In article <Pine.GSO.4.10.10006090447300.19646-100000 at sundial>,
Moshe Zadka  <moshez at math.huji.ac.il> wrote:
>
>No, you're missing my point. At the Python level, there should be a single
>number type. Asking whether a number is integral is fundemantelly
>different then asking whether it is even, and yet nobody advocates having
>odd and even numbers seperate classes deriving from the same base class.
>A number is a number is a number -- and should be a single type. This is
>where "optimize behind the scenes" comes in: we should have a "number"
>type, s.t., isinstance(1, number) as wel as isinstance(1.5, numer), is
>true. However, current implementation details say that it
>would be convinient implementation-wise if type(1)!=type(1.5) -- which is
>fine, just say that type(number) is implementation dependant, and cannot
>be relied upon.

Oh, I see.  Hmmmm....  That makes a lot of sense, yes.  I'm still having
a little trouble wrapping my head around how this works with
user-defined numeric types, but I'll let the people who are into
metaclass programming deal with it.  ;-)
--
                      --- Aahz (Copyright 2000 by aahz at netcom.com)

Androgynous poly kinky vanilla queer het    <*>     http://www.rahul.net/aahz/
Hugs and backrubs -- I break Rule 6

"You could make Eskimos emigrate to the Sahara by vigorously arguing --
at hundreds of screens' length -- for the wonder, beauty, and utility of 
snow."  -- PNH to rb in r.a.sf.f



More information about the Python-list mailing list