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

2005-09-05 Thread Gary Poster
On Sep 5, 2005, at 12:39 AM, Stuart Bishop wrote: Benji York wrote: Stuart Bishop wrote: If this is a way of saying "I'm iterable, but I don't want to tell you how long I am" Right. shouldn't an exeption be raised? Otherwise 'for i in range(0,len(source)): foo = source[i]' could start

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

2005-09-05 Thread Fred Drake
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 consta

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

2005-09-05 Thread Tim Peters
[Fred Drake, on returning sys.maxint from __len__ if you don't know the length, which Tim strongly advises against] > Interesting. I seem to remember this coming from Guido several times > in discussions. Not me. Googling on site:mail.python.org maxint __len__ guido finds 9 hits, all irr

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

2005-09-05 Thread Fred Drake
On 9/5/05, Tim Peters <[EMAIL PROTECTED]> wrote: > I haven't heard that recommendation before, and strongly advise > against it. The result returned by __len__() is often used as a hint > internally, to preallocate result space. This is exactly what the Interesting. I seem to remember this comi

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

2005-09-05 Thread Tim Peters
[Fred Drake] > That's not so weird at all; this is how __len__() is generally used in > Python. sys.maxint is the recommended value to return if the sequence > length is undetermined I haven't heard that recommendation before, and strongly advise against it. The result returned by __len__() is o

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

2005-09-05 Thread Fred Drake
On 9/5/05, Stuart Bishop <[EMAIL PROTECTED]> wrote: > Urgh... I hadn't noticed that in vocabularies before. I believe this has > other side effects too, such as if I do list(mysource), Python calls > mysource.__len__ (if it exists) to preallocate the list size. Wierd things > can happen if your cla

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

2005-09-04 Thread Stuart Bishop
Benji York wrote: > Stuart Bishop wrote: > >> If this is a way of saying "I'm iterable, but I don't want to tell you >> how >> long I am" > > > Right. > >> shouldn't an exeption be raised? Otherwise 'for i in >> range(0,len(source)): >> foo = source[i]' could start blowing up if the source cha