Isn't bool __invert__ behaviour "strange"?

B

Bjoern Schliessmann

MonkeeSage said:
"The C++ standard provides _operator keywords_ (Fig. 21.8) that
can be used in place of several C++ operators." (Deitel & Deitel,
2001; 1082).

Thanks. Only if I'd known that earlier ;)

Regards,


Björn
 
J

John Roth

Saizan said:
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
 
N

Nick Vatamaniuc

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top