Proto-PEP: Overloadable Boolean Operators
Jp Calderone
exarkun at divmod.com
Sun Sep 5 13:40:40 EDT 2004
Miki Tebeka wrote:
> Hello greg,
>
>
>>PEP ??? - Overloadable Boolean Operators
>>========================================
>><snip>
>> Unary: __not__(self)
>>
>> Binary, phase 1: __and1__(self) __or1__(self)
>>
>> Binary, phase 2: __and2__(self, other) __or2__(self, other)
>> __rand2__(self, other) __ror2__(self, other)
>>
>><snip>
>
> Why not just __bool__(self) -> True, False?
> IMO this will answer all of your needs and will require less changes.
There is already a __nonzero__ special. Presumably more control is
desired.
Jp
More information about the Python-list
mailing list