Alexander Belopolsky <[EMAIL PROTECTED]> added the comment: On Wed, Apr 30, 2008 at 2:32 AM, Raymond Hettinger <[EMAIL PROTECTED]> wrote:
> Wouldn't it be better to raise OverflowError or somesuch? Thats what the current code does. I don't know what Guido's full rationale is, but I guess the idea is that len(..) is not supposed to raise an exception on sizeable objects. Here is a quote from another message: """ __len__ will always be problematic when there are more values than can be counted in a signed C long; maybe we should do what the Java collections package does: for once, Java chooses practicality over purity, and simply states that if the length doesn't fit, the largest number that does fit is returned (i.e. for us that would be sys.maxsize in 3.0, sys.maxint in 2.x). """ -- Guido van Rossum, 2008-04-30 http://mail.python.org/pipermail/python-3000/2008-April/013340.html I suspect, however, that part of Java's motivation for this behavior is that exceptions need to be declared and declaring the length method as throwing OverflowError would make many programmers very unhappy. __________________________________ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2723> __________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com