[mod_python] from mod_python import apache

Nic Ferrier nferrier at tapsellferrier.co.uk
Fri Aug 20 11:05:07 EDT 2004


Iker Arizmendi <iker at research.att.com> writes:

> Declaring variables as global within a function
> definition seems to be a syntax error. 

http://docs.python.org/ref/global.html


> But even if I moved the declarations to module scope the global
> variable in the importing module is still not visible in the module
> that is imported (which seems reasonable, otherwise modules would
> risk polluting the namespace of modules they imported).

You're right. The module that is imported would have to import your
main module right back.

What you seem to want is dynamic scope á la lisp.

I don't know if it's possible to do dynamic scope in python.


Nic



More information about the Mod_python mailing list