problem with variable scoping
Michael Dingler
mdingler at mindless.com
Wed May 26 16:29:29 EDT 1999
> Your thinking like this is a C or Pascal program. The assignment of
> last_line_empty creates an instance in the local scope. It does not
> modify the instance in the enclosing scope.
>
> Add 'global last_line_empty' at the top of the function and the problem
> should be fixed.
Thanks.
Indeed my background is more towards C and Pascal, and as lots of scripting
languages try to emulate the idiosyncrasies of them, I kinda suspected
Python was doing the same. Well, one never should think that all algol-like
languages are the same ;)
...Michael...
More information about the Python-list
mailing list