[Antoine Pitrou] > No, but Python is duck-typed and alternate integer classes could adopt such an > implementation while trying to respect the Python-level long API.
Good point. That makes me feel a little uneasy about adding numbits at all. Though I guess there are other parts of Python's integer API that are inherently linked to a binary representation, namely, the bit operations and shifts. And there'd be no *requirement* for alternative integer types to implement numbits (it wouldn't be part of the Integral ABC, for example). [Aahz] > What do you call Decimal? ;-) Um. A stdlib module? I guess I should have said that I can't see Python adopting a nonbinary implementation for the 'int/long' types. It *is* fun to dream about, though: there are some definite advantages to an internal decimal representation---notably, faster str <-> int conversion. And it turns out that overall performance doesn't suffer: I've coded up a Python extension module that implements decimal integers (stored internally in base 10**9) whose performance handily beats that of the current binary int/long. Mark _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com