[Python-Dev] Informal educator feedback on PEP 572 (was Re: 2018 Python Language Summit coverage, last part)

Tim Peters tim.peters at gmail.com
Mon Jul 2 02:35:51 EDT 2018


[Tim]
>> ...
>> So, ya, when someone claims [assignment expressions will] make
>> Python significantly harder to teach, I'm skeptical of that claim.

[Michael Selik]
> I don't believe anyone is making that claim.

I haven't seen it in this specific thread, but the larger discussion has
been going on for several months.

> My worry is that assignment expressions will add about 15 to 20
> minutes to my class and a slight discomfort.

So not intractable - which is my high-order bit ;-)

For those who want more bits of precision (perhaps Guido), while
quantification is good, it needs context to provide insight.  Like, out of
how many class hours total?  Is 15-20 minutes a little, a lot, par for the
course ... compared to other topics?  Will it require you to drop other
topics?  Would you _save_ twice as much class time if we got rid of "is"?
;-)


> As Mark and Chris said (quoting Mark below), this is just one straw in
> the struggle against piling too many things on the haystack. Unlike
> some changes to the language, this change of such general use that
> it won't be an optional topic. Once widely used, it ain't optional.

If it's accepted, do read the PEP - while the syntax will _allow_
assignment expressions just about everywhere, the recommended examples are
all simple & straightforward.  "If it's not obviously better, don't use it"
is excellent advice.

Because it's allowed almost everywhere, I expect that unanticipated "good
uses" will pop up, but at the start a high majority of good uses seem to
fall into a small number of patterns.

Meta:   About the Vasa, I'm not concerned.  C++ has around 150 people
relentlessly writing an endless sequence of enhancement proposals largely
aimed at highly esoteric expert applications of an already extraordinarily
complex language.  Bjarne Stroustrup is right to be concerned about that.
His goal is to cut back on the complications striving for theoretical
perfection in all conceivable applications, and go back to working on ideas:

that can be used by “ordinary programmers” whose main concern is to ship
> great applications on time

    http://open-std.org/JTC1/SC22/WG21/docs/papers/2018/p0977r0.pdf

If C++ hadn't inherited assignment expressions from C from the start(*), I
expect that's an idea he'd _want_ to consider now.  They're well within the
grasp of "ordinary programmers" - if they can master `j = 3`, they're 90%
of the way to mastering `j := 3` (although it may be that "good taste"
can't be taught at all).

(*) Yes, I know about the stuff added to support yet another form of
assignment expression in `if` and `switch` headers in C++ 17.  That
appeared to be more for "theoretical purity".  Assignment expressions were
always allowed there, but previously only `for` headers allowed _declaring_
a new variable inside the parens.  Now `if` and `switch` allow that too.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20180702/1ecfbf63/attachment.html>


More information about the Python-Dev mailing list