On Tue, Sep 2, 2008 at 2:53 PM, Guido van Rossum <[EMAIL PROTECTED]> wrote: > The only time when __len__ can be larger than sys.maxsize is when the > class implements some kind of virtual space where the values are > computed on the fly. In such cases trying to walk over all values is > bound to take forever, and the length is likely not of all that much > interest to the caller -- but sometimes we may need to pass such an > object to some library code we didn't write that is making some > trivial use of len(), like the examples I gave before. > > That said, I would actually be okay with the status quo (which does > raise an OverflowError) as long as we commit to fixing this properly > in 2.7 / 3.1, by removing the range restriction (like we've done for > other int operations a long time ago).
+1 Otherwise it sounds like these virtual containers shouldn't support len() at all. Maybe a .len() method instead, with all the TMTOWTDI that implies. -- Adam Olsen, aka Rhamphoryncus _______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com