[Python-ideas] the optional "as" statement inside "if" statements
Devin Jeanpierre
jeanpierreda at gmail.com
Wed Jul 4 18:35:57 CEST 2012
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?
Generally, AIUI, because lexical scoping is only really interesting in
contrast to static scoping, any variable whose scope can be determined
statically based on where it's defined is considered "lexically
scoped".
-- Devin
More information about the Python-ideas
mailing list