[Python-ideas] Changing the meaning of bool.__invert__

Paul Moore p.f.moore at gmail.com
Sun Apr 10 06:15:28 EDT 2016


On 10 April 2016 at 07:46, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> Guido van Rossum wrote:
>>
>> Let me pronounce something here. This change is not worth the amount
>> of effort and pain a deprecation would cause everyone. Either we
>> change this quietly in 3.6 (adding it to What's New etc. of course) or
>> we don't do it at all.
>
> I'm having trouble seeing why it should be done at all.
> What actual problem would it be solving? Does anyone
> desperately want to be able to spell boolean negation
> as ~b instead of not b?

I have no axe to grind either way, but my impression from this thread
is that some people would prefer bool to be consistent with
user-defined types (such as numpy's) in this regard - specifically
because user-defined types *have* to use ~ as the negation operator
because "not" is not overridable in they way they require.

Paul


More information about the Python-ideas mailing list