Isn't bool __invert__ behaviour "strange"?

Carsten Haese carsten at uniqsys.com
Fri Sep 22 11:42:06 EDT 2006


On Fri, 2006-09-22 at 11:25, Saizan wrote:
> Bjoern Schliessmann wrote:
> > Saizan wrote:
> >
> > > Why subclassing bool from int either __invert__ or __neg__ haven't
> > > been overrided to produce a boolean negation?
> >
> > I wonder what -True or -False should evaluate to.
> Well in boolean notation -True == False and  -False == True, actually
> you may prefer ¬ or a line over the term, but since there's no such
> operator in python [...]

It's called "not":

>>> not True
False
>>> not False
True

-Carsten





More information about the Python-list mailing list