[Zope3-dev] Re: [Zope3-checkins] SVN: Zope3/trunk/src/zope/schema/interfaces.py - add IIterableChoice and note the desire to depricate vocabularies

Fred Drake fdrake at gmail.com
Mon Sep 5 13:07:06 EDT 2005


On 9/5/05, Tim Peters <tim.peters at gmail.com> 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


More information about the Zope3-dev mailing list