Future division patch available (PEP 238)

Marcin 'Qrczak' Kowalczyk qrczak at knm.org.pl
Sun Jul 22 06:08:36 EDT 2001


22 Jul 2001 09:55:50 GMT, Marcin 'Qrczak' Kowalczyk <qrczak at knm.org.pl> pisze:

> My taste suggests the following:

One more thing: I would unify ints are longs. I don't care if they
are kept the same type or distinct types, i.e. whether the difference
in the representation is an implementation detail inside the type
or is visible. The thing that matters is that operations which would
overflow on ints return a correct result as a long.

Rationals can use a similar technique for efficiency: as long as
nominator and denominator are small enough, they can be kept as
machine integers internally.

I think that always normalizing rationals to gcd(n,d)==1 is a good
default. For specialized calculations where it's not needed, there
is always the possibility to use a different type - even work with
nominators and denominators explicitly...

-- 
 __("<  Marcin Kowalczyk * qrczak at knm.org.pl http://qrczak.ids.net.pl/
 \__/
  ^^                      SYGNATURA ZASTĘPCZA
QRCZAK



More information about the Python-list mailing list