[Python-Dev] PEP 572: Assignment Expressions

Chris Angelico rosuav at gmail.com
Tue Apr 24 02:38:39 EDT 2018


On Tue, Apr 24, 2018 at 4:27 PM, Antoine Pitrou <solipsis at pitrou.net> wrote:
> On Tue, 24 Apr 2018 01:06:30 -0500
> Tim Peters <tim.peters at gmail.com> wrote:
>>
>> > - does it make Python easier to learn and teach?
>>
>> By whom?  Almost no addition has ever made a language easier to learn
>> for raw beginners:  every addition is something they eventually need
>> to learn.  We could make Python easier to learn for beginners by
>> throwing out virtually everything added since version 0.9.6 ;-)
>
> Constructs like "with ..." or "try / except / finally" make the
> language easier to learn compared to the dances they are meant to
> replace.  "await" is a more readable and less confusing improvement
> over "yield from".  Format strings dispense from the older, more
> convoluted formulations.  Iteration is much simpler than the longer
> forms we would have to write if generalized iterators didn't exist.

And assignment expressions are far simpler than breaking things out
over multiple lines (particularly when you consider the infinite while
loop alternative). But that doesn't change the fact that, as features,
they do make the language harder to understand. The difference is that
they make *your program* easier to understand. If you really want the
*language* to be as easy as possible to fit into your head, you want a
Turing tarpit:

https://esolangs.org/wiki/Ook!

Only three lexical tokens, and only eight operations. But any program
written in Ook is going to be almost completely unreadable. That's the
tradeoff.

ChrisA


More information about the Python-Dev mailing list