On 9/5/05, Tim Peters <[EMAIL PROTECTED]> wrote:
> Not me.  Googling on
> 
>     site:mail.python.org maxint __len__  guido
> 
> finds 9 hits, all irrelevant.  There's no instance of returning
> sys.maxint from a __len__ method in the Python codebase; there are
> instances of returning small constants.

I was actually referring to in-person discussions, but perhaps I'm
missing some context or something.  I'm not arguing that it's a sane
approach.

> If you don't/can't know the length, return "a typical" size, or leave
> __len__() undefined (in which latter case CPython will usually guess
> 8).  As the code example I gave before showed, returning sys.maxint
> creates needless problems.

Let's get this documented by adding something to the Language
Reference; this should be a lot easier to find.


  -Fred

-- 
Fred L. Drake, Jr.    <fdrake at gmail.com>
Zope Corporation
_______________________________________________
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com

Reply via email to