[Python-ideas] the optional "as" statement inside "if" statements

Masklinn masklinn at masklinn.net
Wed Jul 4 19:30:12 CEST 2012


On 2012-07-04, at 18:35 , Devin Jeanpierre wrote:

> On Wed, Jul 4, 2012 at 12:19 PM, Matt Joiner <anacrolix at gmail.com> wrote:
>> There's no point doing this in Python since scoping is function-level
>> and not lexical. Just move the assignment to the line preceding the if
>> statement.
> 
> I'm not sure what distinction you want to draw here between "lexical
> scoping" and "function-level scoping". Is your issue that scopes
> cannot be inferred during the lexing phase? Or is it something else?

Guessing he misused "lexical scoping" for block-based scoping (as in
e.g. C) or explicit scoping constructs (e.g. `let`-type constructs).

> Generally, AIUI, because lexical scoping is only really interesting in
> contrast to static scoping

And I see you miswrite as well, "lexical scoping" and "static scoping"
are the same thing, and opposed to "dynamic scoping" (where name
resolution traverses the call stack).



More information about the Python-ideas mailing list