Lexical Scope
Paul Clinch
pclinch at internet-glue.co.uk
Thu Oct 30 13:45:57 EST 2003
More information about the Python-list mailing list
Thu Oct 30 13:45:57 EST 2003
- Previous message (by thread): Lexical Scope
- Next message (by thread): serial port access
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
>From the language lawyers section of python doc.s :-
"If a name is assigned to anywhere in a code block (even in
unreachable code), and is not mentioned in a global statement in that
code block, then it refers to a local name throughout that code
block."
Try:-
def run():
a = 1
def run2(b):
global a
print a
a = b
run2(2)
print a
run()
- Previous message (by thread): Lexical Scope
- Next message (by thread): serial port access
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list