[Tutor] beginning to code
On Tue, 12 Sep 2017 23:20:21 -0700, Rick Johnson wrote:
> Steven D'Aprano wrote:
>> Rick Johnson wrote:
>> > But just because we have been trained that the implicit `if x:` is
>> > shorthand for the reasonable `if bool(x) == True:`
>> That's not reasonable. bool(x) already returns a True or False flag,
>> comparing it to True is superfluous.
> So what? That's a simple matter of translating source code to byte code
Who cares about the byte code? We don't read or write byte code.
The *source code* you wrote is dumb. It displays an appalling lack of
understanding of Python's semantics, and poor reasoning about even the
simplest logical tests. Here's another person's comments:
"When I see someBool == true, I can't help but feel like the programmer
hasn't internalized the idea of evaluation, which is a pretty fundamental
You might as well write:
if (x is True) and (True is True): # just in case True is False
In plain English terms, you are doing the equivalent of saying:
"Is (is that true?) true?"
Who talks like that?
Why should we write code like that?
?You are deluded if you think software engineers who can't write
operating systems or applications without security holes, can write
virtualization layers without security holes.? ?Theo de Raadt