[Python-ideas] Changing the meaning of bool.__invert__
Niki Spahiev
niki.spahiev at gmail.com
Fri Apr 8 03:46:36 EDT 2016
On 8.04.2016 09:26, Greg Ewing wrote:
> Michael Selik wrote:
>> To clarify, the proposal is: ``~True == False`` but every other
>> operation on
>> ``True`` remains the same, including ``True * 42 == 42``. Correct?
>
> Seems to me things are fine as they are.
>
> The justification for & and | on bools returning bools
> is that the result remains within the domain of bools,
> even when they are interpreted as int operations.
>
> But ~ on a bool-interpreted-as-an-int doesn't have
> that property, so ~True is more in the realm of
> True * 42 in that regard.
What should be the result of +True? 1 or True?
regards,
Niki
More information about the Python-ideas
mailing list