[Python-3000] __nonzero__ vs. __bool__

Walter Dörwald walter at livinglogic.de
Tue Nov 21 18:43:20 CET 2006


Guido van Rossum wrote:
> On 11/21/06, Ivan Krstić <krstic at solarsail.hcs.harvard.edu> wrote:
>> Guido van Rossum wrote:
>>> Can anyone help out evaluating this patch? If it has to wait for me
>>> it's gonna be a looooooong wait...
>> Looks fine to me functionally, although it seems to gratuitously retab
>> some code that used to be aligned with tabstop 8 to a tabstop of 4.
> 
> Thanks! I hope you meant "indentation level" instead of "tabstop".
> Tomer, can you fix the indentation to be whatever's prevailing in the
> file you're editing?

Another question is whether __bool__() should be allowed to return an
int (or any other object), or if it *must* be a bool. (The patch
currently allows ints). What if __bool__() returns subclasses of int,
that overwrite __bool__() themself?

Servus,
   Walter



More information about the Python-3000 mailing list