Peter Moody wrote:
On Wed, Sep 16, 2009 at 1:35 PM, Antoine Pitrou <solip...@pitrou.net> wrote:
Le Mon, 14 Sep 2009 09:44:12 -0700, Peter Moody a écrit :
Folks, Guido,

I believe PEP 3144 is ready for your review.  When you get a chance, can
you take a look/make a pronouncement?
Besides what has already been said in the thread, I have a bunch of
comments:

   It should be noted
   that __len__ doesn't work as expected since python internals has this
   limited to a 32 bit integer and it would need to be at least 128 bits
to
   work with IPV6.

You should clarify what it means: does the result get truncated, or is an
error thrown when it can't fit inside an int?

I'll clarify this, but it looks like this:

len(xrange(0xFFFFFFFFFFFFFFFFFFFFFFFFF))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OverflowError: long int too large to convert to int

basically, __len__(self): can only return an int. At least that's what
I recall from the discussion.

FWIW, the limitation remains in Py3, with a modified error msg.
>>> len(range(0xFFFFFFFFFFFFFFFFFFFFFFFFF))
Traceback (most recent call last):
  File "<pyshell#1>", line 1, in <module>
    len(range(0xFFFFFFFFFFFFFFFFFFFFFFFFF))
OverflowError: Python int too large to convert to C ssize_t

_______________________________________________
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

Reply via email to