[Python-ideas] Inline assignments using "given" clauses
Sven R. Kunze
srkunze at mail.de
Sun May 13 05:55:33 EDT 2018
On 13.05.2018 11:23, Peter O'Connor wrote:
> *Correction: Above code should read:
> outputs = 
> state = initial_state
> for inp in inputs:
> out, state = my_update_func(inp, state)
Question still stands if this type of code needs compaction in the first
List comprehensions usually have some sort of declarative touch (set
Even though, striving for a more compacted version, I tend to think that
using a declarative version of it doesn't serve it well in the long term.
We recently came across the following code snippet in our source base
(1st answer of
It was absolutely not comprehensible.
Your example is inherently imperative because the internal state changes
from iteration to iteration; something unusual for set builder notation.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-ideas