How about assignment to True and False...

Nick Vatamaniuc vatamane at gmail.com
Sun Sep 24 01:29:10 EDT 2006


Perhaps it will be addressed in 3.0...

I hope True and False could become keywords eventually. That would stop
silliness like:
---------------------
In [1]: False=True

In [2]: not False
Out[2]: False

In [3]: False
Out[3]: True
---------------------

Nick V.


John Roth wrote:
> Saizan wrote:
> > John Roth wrote:
> >
> > > The not operator and the bool() builtin produce
> > > boolean results. Since bool is a subclass of int,
> > > all the integer operations will remain integer
> > > operations. This was done for backwards
> > > compatability, and is unlikely to change in the 2.x
> > > series.
> >
> > Ok, shame on me, I completely overlooked "not" and it surprises myself
> > because it's not like I haven't used it, I just didn't see "not" as an
> > operator, maybe because i can't find a __not__ method in bool class.
> > (Is it hidden somewhere or is computed in some other way?)
>
> None of the boolean operators have magic methods.
> PEP 335 addresses this issue, but it's been sitting
> there for over two years with no action. It's probably
> lost any traction it ever had.
> 
> John Roth




More information about the Python-list mailing list