Poletto Guillaume
polettog at gmail.com
Sun Aug 17 17:19:57 EDT 2008
Hi, Yes, I'm new to both Python programming language and mod_python and i found the import_module() paragraph in the manual not really easy to eat. What I understood is that, a such function is necessary to reload modified modules used by the webserver because the interpreter lives as long as the apache child process lives. Okay, but what was not clear is : does mod_python overrides the Python's statement "import" to make the same things than import_module()? If yes, why this function? I made a test and i modified a module imported by "import" statement in my handler module : the changes where taken in count without restarting apache Maybe the difference is in the treatment of packages.. The import_module() breaks all namespace stuff with packages (we could not do the same as "import package.subpackage.module" and then use stuff with "package.subpackage.module.function()" notation, although this doesn't seem to be recommanded in classic python softwares) As I am new to Python, i was first thinking of designing my website like a classic python application, with packages and stuff, but tell me i should rather think of arranging my modules in classic directories and use import_module() each time. Thanks
|