[Python-ideas] Fwd: Fwd: Fwd: unpacking generalisations for list comprehension

Paul Moore p.f.moore at gmail.com
Tue Oct 18 04:15:27 EDT 2016


On 18 October 2016 at 07:31, Nick Coghlan <ncoghlan at gmail.com> wrote:
>
> Forcing ourselves to come up with a name for the series of values
> produced by the outer iteration then makes that name available as
> documentation of our intent for future readers of the code.

This is a key point, that is frequently missed when people propose new
"shorter" syntax, or constructs that "reduce indentation levels".

Make no mistake, coming up with good names is *hard* (and I have
enormous respect for the (often unrecognised) people who come up with
intuitive APIs and names for functions). So it's very easy to be
tempted by "concise" constructs that offer the option of not naming an
operation. But as someone who spends 99% of his time doing maintenance
programming, be sure that the people who support your code will thank
you for spending time naming your abstractions (and avoiding using
constructs like the one proposed here).

Paul


More information about the Python-ideas mailing list