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

Rob Cliffe rob.cliffe at btinternet.com
Fri May 11 21:37:20 EDT 2018

Yeah, well, I'm totally lost.  Even after trying out this code, and 
refactoring it once if not twice, I didn't understand it.  I don't know 
what point you're trying to prove, but you seem to have comprehensively 
proved it.

On 11/05/2018 15:04, Jacco van Dorp wrote:
> A while ago, we had this gem:
> 2018-04-06 8:19 GMT+02:00 Serhiy Storchaka <storchaka at gmail.com>:
>> Using currently supported syntax:
>>      smooth_signal = [average for average in [0] for x in signal for average in [(1-decay)*average + decay*x]]
> Go ahead and understand that line in 1 go. It's currently legal syntax
> for a running average for a smoothing signal, which remembers
> something about it. (Subject: Proposal: A Reduce-Map Comprehension and
> a "last" builtin)
> You're not allowed to work it out bit by bit, just understand the
> entire line or nothing. Any failure of yours proves my point.
>> [João]
>> How do you read something like " while (cmd := get_command()).token != CMD_QUIT:" in plain english?
> while open-paren cee em dee colon is call get-underscore-command
> close-paren dot token doesn't equal all-caps cee em dee underscore
> quit colon.
> Might be some dutch in there.
> But far more importantly, I can hold the concept into my head, or just
> the parts of it that I need. How we call it in english is actually not
> a good argument - whether we can easily mentally parse it is, since I
> tend not to code by voice command, but with a keyboard. Your mileage
> may vary, but I think we should optimize for keyboard coding over
> voice chat coding. And when I need to refer to it, I say "this bit
> here" or I copy paste it.
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
> ---
> This email has been checked for viruses by AVG.
> http://www.avg.com

More information about the Python-ideas mailing list