[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Tutor] beginning to code

Steven D'Aprano wrote:
> 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.

That was my point! Are you really this dense or just
trolling me?

> The *source code* you wrote is dumb. It displays an
> appalling lack of understanding of Python's semantics, 

No, it is the Python semantics that are dumb, not my code.

> and poor reasoning about even the simplest logical tests.

Code is read more often than it is written, so if we must
invest a few more keystrokes into a statement so that the
_intent_ is _clear_, then so be it. And if such clarity
produces sub-optimal byte code, well, that is a simple
matter of redefining Python's translation procedure for the
benefit of the _human_, not for the benefit of the
_machine_, and certainly not for the sake of arbitrarily
designed evaluation rules. Your priorities are all screwed-
up, D'Aprano.

> 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 deficiency."

Like a canine, this "other person" has been trained for
blind obedience, and obviously has no idea that source code
is meant for human communication, and evaluation is
arbitrarily defined.

> You might as well write:

[snip: absurd ramblings]