Philosophical long integer question...

Ralf Muschall rmuschall.fih at t-online.de
Fri Mar 31 14:41:51 EST 2000


Brian Kelley schrieb:

> I hadn't thought about this approach.  Currently python will not promote

This is acceptable for me, and probably gives the fastest code.
Haskell uses the same approach (and it is disputed there as well).

> unless forced.  What if the procedure was reversed?  Promote unless
This might be easier for newbies. Lisp uses this approach (almost
-- fixnums and bignums are diferent types, and promotion causes a
type change when necessary).

> this what you mean?
It is a possibility. Whether it is needed depends on whether python
is slow enough to justify the introduction of C-based int32 etc.
Otherwise just making a class int32 and having the constructor
(and maybe other methods) bitwise_and_ing it's argument with
2^32-1 would suffice.

> certainly would affect a lot of code...)
It might break code which silently assumes that ints live in
the ring Z/(2^32*Z) -- that's why I mentioned crypto hackers.

Ralf



More information about the Python-list mailing list