problem with variable scoping

Michael Dingler mdingler at mindless.com
Wed May 26 16:33:13 EDT 1999


Martijn Faassen wrote:
> If no assignment to myglob occurs in the function's namespace the global
> namespace is used.
> 
> This all has interesting reasons and consequences that Tim Peters can
> tell you the advantages of. :)

I'd certainly like to hear them. I'd like to know how other languages
handle this. Doesn't Perl do it the other way round, i.e. a _local_
keyword? 
 
> Note that it's good practice to try to avoid global variables in your
> program (though they're useful sometimes, of course). Python provides
> classes that often provide a more elegant solution; you can use a member
> variable instead of a global variable.

I will. This being my first Python program, I just wanted to test the
basic concepts before I try to restructere it. Heck, most of the
program consists of print statements ;)
 
> Also take a look at StructuredText, a Python module that's part of
> Digital Creation's Zope (www.zope.org), but can be used independently.
> It does something similar to what you are trying to accomplish, I think.

htmlpp has a thing called 'guru' mode. But as it's written in Perl, I just
get into point haired boss mode (i.e. dollar signs on my eyes...)

...Michael...




More information about the Python-list mailing list