[Python-3000] __nonzero__ vs. __bool__

Guido van Rossum guido at python.org
Tue Nov 21 17:09:07 CET 2006


Can anyone help out evaluating this patch? If it has to wait for me
it's gonna be a looooooong wait...

On 11/21/06, tomer filiba <tomerfiliba at gmail.com> wrote:
> http://sourceforge.net/tracker/index.php?func=detail&aid=1600346&group_id=5470&atid=305470
>
> """some notes:
>  * the latex docs have been updated
>  * the slot name was changed from nb_nonzero to nb_bool
>  * all XXX_nonzero methods where changed to XXX_bool
>  * all the comments relating to nb_nonzero have been updated
>  * stdlib was updated
>  * all the test suites were updated
>
>  otoh, i couldn't get it to compile (MSVC++2003), because of a strange
> bug in ceval.c (none of my code). seems the GETLOCAL macro causes
> syntactic problems, but i didn't have time to check it thoroughly."""
>
>
> -tomer
>
>
> On 11/21/06, Guido van Rossum < guido at python.org> wrote:
> > Looks about right. Patch?
> >
> > On 11/20/06, tomer filiba < tomerfiliba at gmail.com> wrote:
> > > how about changing the name of __nonzero__ to __bool__?
> > >
> > > today it looks like:
> > > * int(x) --> x.__int__()
> > > * long(x) --> x.__long__()
> > > * float(x) --> x.__float__()
> > > * str(x) --> x.__str__()
> > >
> > > but for bool it's x.__nonzero__()
> > >
> > > i'd guess __nonzero__ existed even before the bool type was introduced
> > > ( 2.2?),
> > > but in the cleanup-old-design-issues spirit, perhaps it can be made
> > > symmetrical
> > > to the other builtin types.
> > >
> > >
> > > -tomer
> > > _______________________________________________
> > > Python-3000 mailing list
> > > Python-3000 at python.org
> > > http://mail.python.org/mailman/listinfo/python-3000
> > > Unsubscribe:
> > >
> http://mail.python.org/mailman/options/python-3000/guido%40python.org
> > >
> > >
> > >
> >
> >
> > --
> > --Guido van Rossum (home page: http://www.python.org/~guido/)
> >
>
>


-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-3000 mailing list