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

Sven R. Kunze srkunze at mail.de
Fri May 11 06:51:32 EDT 2018


On 11.05.2018 09:33, Greg Ewing wrote:
> Gustavo Carneiro wrote:
>> IMHO, all these toy examples don't translate well to the real world 
>> because they tend to use very short variable names while in real 
>> world [good written code] tends to select longer more descriptive 
>> variable names.
>
> I don't believe that's always true. It depends on the context.
> Sometimes, using long variable names can make code *harder*
> to read.
>
> I don't think there's anything unrealistic about this
> example:
>
>    if m given m = pattern.match(the_string):
>       nugget = m.group(2)

I gather we don't talk about interactive usage.

So, I grepped through part of our code-base. Like it or not, it's almost 
always called "match" there.

Like Gustavo, I also have the feeling that long-living, real-world code 
tends to have more descriptive names than all those toy examples/arguments.


Cheers,
Sven


More information about the Python-ideas mailing list