[Python-ideas] Changing the meaning of bool.__invert__
p.f.moore at gmail.com
Thu Apr 7 16:26:38 EDT 2016
On 7 April 2016 at 21:08, Random832 <random832 at fastmail.com> wrote:
> On Thu, Apr 7, 2016, at 16:05, Terry Reedy wrote:
>> Given that ~bool hardly make any sense currently, I would not expect it
>> to be in much use now. Hence not much to break.
> I suspect the fear is of one being passed into a place that expects an
> int, and staying alive as a bool (i.e. not being converted to an int by
> an arithmetic operation) long enough to confuse code that is trying to
> do ~int.
That is indeed the only place likely to hit problems. But I'd be
surprised if it was sufficiently common to be a major problem. I don't
think the backward compatibility constraints on a minor release would
preclude a change like this.
Personally, I'm +0 on the proposal. It seems like a more useful
behaviour, but it's one I'm never likely to need personally.
More information about the Python-ideas