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

[Tutor] beginning to code

On Wed, Sep 13, 2017 at 3:22 AM, Rick Johnson
<rantingrickjohnson at gmail.com> wrote:
> So, what are your answers to my four questions:
>     (1) Is it a speed issue? Then prove it.
>     (2) Is it a readability issue? If so, then that's an
>     opinion _you_ get to have.
>     (3) Is it a matter of "python purity"?  If so, then map
>     should be removed from the language, and don't forget to
>     remove reduce and filter while you're at it, and then,
>     you may want to grab a shield because the functional
>     fanboys will be all over you like white on rice! (psst:
>     here comes Rustom Mody now!!!)
>     (4) Something else...?

(Oops, premature send.)

#1 is almost certainly true, since non-code is invariably faster than
code (either way, int() gets called). But that's not the point.

#2 is part of the point. But not the main point.

#3 - if you mean that map violates purity in some way, then (a) I
never said to remove it, and (b) Python never brags that purity is its

#4. Catch-all, I guess.

Do you write:
    if x:

or do you write:
    if bool(x):

or maybe:
    if bool(x) is True:

or perhaps:
    if (bool(x) is True) is True:

or even:
    if (bool(x) is True) == (True is not False):

Redundant code does not belong.