Is len() restricted to (positive) 32-bit values?

Jean-Paul Calderone exarkun at divmod.com
Thu Dec 29 22:19:46 EST 2005


On 29 Dec 2005 19:14:36 -0800, Josh Taylor <joshua.taylor at gmail.com> wrote:
>I have a class that wraps a large file and tries to make it look like a
>string w.r.t. slicing.  Here, "large file" means on the order of
>hundreds of GB.  All the slicing/indexing stuff through __getitem__()
>works fine, but len() is quite broken.  It seems to be converting the
>value returned by __len__() to a 32-bit integer.  If the conversion
>yields a negative number, it raises an exception.
>
>I'm running Python 2.4.1 on an Opteron running RedHat FC3.  It's a
>64-bit processor, and Python ints appear to be 64-bit as well, so even
>if len() only works with ints, it should still be able to handle 64-bit
>values.

Conspicuous timing:

  <http://mail.python.org/pipermail/python-dev/2005-December/059266.html>

Jean-Paul



More information about the Python-list mailing list