[Python-Dev] PEP 572: Assignment Expressions

Antoine Pitrou solipsis at pitrou.net
Tue Apr 24 02:57:13 EDT 2018


On Tue, 24 Apr 2018 16:38:39 +1000
Chris Angelico <rosuav at gmail.com> wrote:
> 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.

I did specifically say "easier to learn and teach" instead of using
generic phrases such as "simpler" or "harder to understand".  You won't
make Python easier to learn and teach by adding a new assignment
syntax, since people will have to learn the old form as well.

Having to break things out over multiple lines is a fact of life, if
only for readability when implementing (and maintaining!) non-trivial
processing routines. It's a good thing to be used to it, and to learn to
choose good names for intermediate variables.

Regards

Antoine.




More information about the Python-Dev mailing list