gmp module

Andrew Kuchling akuchlin at mems-exchange.org
Tue Nov 7 18:02:45 CET 2000


"Alex Martelli" <aleaxit at yahoo.com> writes:
> ExtensionClass (a part of Zope, but also released
> separately) is, I think, what could help doing this.
> But, in general, I don't think it's possible (or,
> surely, not easy), while py_cpp does make it easy.

I don't think ExtensionClass fully supports numeric behaviour, partly
due to limitations in ExtensionClass and partly due to architectural
issues in Python.  For example, ExtensionClasses don't support
__radd__ & related methods.

The old GMP module could be dropped on top of Objects/longobject.c to
make Python use GMP for all longs.  This worked for 1.4 and 1.5.2, but
breaks in 2.0 because there are more C-level conversion functions,
mostly for C's "long long" type, in 2.0, which obviously aren't
implemented yet.  Eventually I'll get around to checking if GMP 3.x
adds interfaces that support long long.  I wonder if it would be
practical to require GMP for Python and just use its fancy and fast
implementation of long integers instead of Python's simple and
not-so-fast implementation.

--amk



More information about the Python-list mailing list