Re: [Python-3000] __nonzero__ vs. __bool__

2006-11-22 Thread Guido van Rossum
Once all who care agree on the patch, feel free to check it in without my review. On 11/22/06, Walter Dörwald <[EMAIL PROTECTED]> wrote: > Jack Diederich wrote: > > > On Wed, Nov 22, 2006 at 09:36:09AM +0100, Georg Brandl wrote: > >> Terry Reedy schrieb: > >>> "Brett Cannon" <[EMAIL PROTECTED]> wr

Re: [Python-3000] __nonzero__ vs. __bool__

2006-11-22 Thread Walter Dörwald
Jack Diederich wrote: > On Wed, Nov 22, 2006 at 09:36:09AM +0100, Georg Brandl wrote: >> Terry Reedy schrieb: >>> "Brett Cannon" <[EMAIL PROTECTED]> wrote in message >>> news:[EMAIL PROTECTED] >>> >>> Why can't the fallback usage just pass the return value from __len__ to >>> bool() (forget the

Re: [Python-3000] __nonzero__ vs. __bool__

2006-11-22 Thread Jack Diederich
On Wed, Nov 22, 2006 at 09:36:09AM +0100, Georg Brandl wrote: > Terry Reedy schrieb: > > "Brett Cannon" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > > > > Why can't the fallback usage just pass the return value from __len__ to > > bool() (forget the C function name) and retu

Re: [Python-3000] __nonzero__ vs. __bool__

2006-11-22 Thread Georg Brandl
Terry Reedy schrieb: > "Brett Cannon" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > Why can't the fallback usage just pass the return value from __len__ to > bool() (forget the C function name) and return that result? It's just like > doing:: > > def bool(obj): > t

Re: [Python-3000] __nonzero__ vs. __bool__

2006-11-21 Thread Delaney, Timothy (Tim)
Terry Reedy wrote: > If an object without __bool__ returned itself as its length, this > would be > an infinite loop, at least in this Python version. Do we worry about > something so crazy? Doesn't len() have a requirement that __len__ return an integer? If so, perhaps it would be better if th

Re: [Python-3000] __nonzero__ vs. __bool__

2006-11-21 Thread Terry Reedy
"Brett Cannon" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Why can't the fallback usage just pass the return value from __len__ to bool() (forget the C function name) and return that result? It's just like doing:: def bool(obj): try: return obj.__bool__()