[Python-Dev] PEP 572: Write vs Read, Understand and Control Flow

Chris Angelico rosuav at gmail.com
Thu Apr 26 02:53:17 EDT 2018


On Thu, Apr 26, 2018 at 3:54 PM, Stephen J. Turnbull
<turnbull.stephen.fw at u.tsukuba.ac.jp> wrote:
> Chris Angelico writes:
>
>  > Additionally, naming sub-parts of a large expression can assist an
>  > interactive debugger, providing useful display hooks and partial
>  > results. Without a way to capture sub-expressions inline, this
>  > would require refactoring of the original code; with assignment
>  > expressions, this merely requires the insertion of a few ``name
>  > :=`` markers. Removing the need to refactor reduces the likelihood
>  > that the code be inadvertently changed as part of debugging (a
>  > common cause of Heisenbugs),
>
> Period here preferred.
>
>  > and is easier to dictate to a student or junior programmer.
>
> True but gratuitous.  It's also true that it's easier to dictate to
> Guido or Tim, though you might be happier if you let them refactor!
>

Well, true. The point isn't WHO you're dictating to, but that you can
dictate it at all. "Hmm, let's see. Toss a 'foo colon-equals' in front
of X, then print out what foo is." My day job involves a lot of
helping students learn how to debug, so I say this kind of thing a lot
(even if it's obvious to me what the problem is, because the student
needs to learn debugging, not just be told what to fix). Refactoring
just for the sake of a print call is overkill and potentially risky
(if the student edits the wrong thing).

Feel free to suggest an alternate wording.

ChrisA


More information about the Python-Dev mailing list