[Python-ideas] Assignments in list/generator expressions

Georg Brandl g.brandl at gmx.net
Tue Apr 12 11:57:13 CEST 2011

On 12.04.2011 10:31, Nick Coghlan wrote:
> On Tue, Apr 12, 2011 at 4:51 PM, Eric Snow <ericsnowcurrently at gmail.com> wrote:
>> I know this throws off the approach the PEP takes, but I am trying to wrap
>> my head around how I would use statement local namespaces.  I like how it
>> cleans up from the namespace those bits that only matter to the target
>> statement.  It does make it easier to follow to whom those statements in the
>> given block belong.
> Yeah, in order variants have been part of the discussion since the
> beginning, usually in a 2-suite form like:
> let:
>    # local namespace
> in:
>   # binding here affect surrounding scope
>   # but can also see names bound in "let" clause
> Dropping the second suite (and having the given clause implicit modify
> the following statement) isn't really feasible (and far more brain
> bending than adding a new clause to augment simple statements).

However, if dropping the second suite is allowed (without any effect on
the next statement of course), you escape from the "pass given" ugliness :)


More information about the Python-ideas mailing list