[Python-ideas] Inline assignments using "given" clauses

Nick Coghlan ncoghlan at gmail.com
Thu May 10 17:22:59 EDT 2018

On 10 May 2018 at 11:10, Guido van Rossum <guido at python.org> wrote:

> Please no, it's not that easy. I can easily generate a stream of +1s or
> -1s for any proposal. I'd need well-reasoned explanations and it would have
> to come from people who are willing to spend significant time writing it up
> eloquently. Nick has tried his best and failed to convince me. So the bar
> is high.
> (Also note that most of the examples that have been brought up lately were
> meant to illustrate the behavior in esoteric corner cases while I was
> working out the fine details of the semantics. Users should use this
> feature sparingly and stay very far away of those corner cases -- but they
> have to be specified in order to be able to implement this thing.)

I raised this with some of the folks that were still here at the Education
Summit (similar to what I did for data classes at the PyCon Australia
education seminar last year), but whereas the reactions to data classes
were "as easy or easier to teach as traditional classes", the reaction for
this for the folks that I asked was almost entirely negative - the most
positive reaction was "Yes, if it's as a wholesale replacement for the '='
spelling, since that sometimes gets confused with mathematical equality".
As an *addition* to the existing spelling, and especially with the now
proposed leaking semantics in comprehension scopes, it was "No, that would
just confuse out students".

It's one thing adding syntactic and semantic complexity for the sake of
something that significantly increases the language's expressive power
(which is what the original sublocal scopes proposal was aiming for: the
ability to more readily express constrained scoping and name shadowing
without explicit name aliasing and del statements), it's something else
entirely to do it for the sake of purely cosmetic tweaks like flattening
the occasional nested if-else chain or replacing a loop-and-a-half with an
embedded assignment.


Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20180510/c64347ae/attachment.html>

More information about the Python-ideas mailing list