On May 13, 3:27 pm, globalrev <skanem...@yahoo.sewrote:
i cant figure outif python has lexical or general scope.
it seems functions have lexical scope but with some restrictions and
Yes. (You can't modify a local variable from an inner scope--this
will change in Python 3.0.)
some non-function scopes are dynamic?
No: I presume you mean the class statement, which is the only thing
other than def that introduces a scope in Python, but it's neither
dynamic nor lexical. In fact it's closed: you can only access
variables in a class scope from that scope, and not from enclosed
scopes (e.g., method defintions) at all.
Carl Banks