[Web-SIG] Re: WSGI and Configuration
Phillip J. Eby
pje at telecommunity.com
Sun Nov 14 18:15:45 CET 2004
At 07:46 AM 11/14/04 -0600, Ian Bicking wrote:
>I always wondered why the multiple interpreters weren't accessible from
>Python code. But I can imagine that would open up a big can of worms...
Multiple interpreters are actually pretty simple, at least in
principle. AFAIK, the main issues they have are with sharing extension
modules across interpreters. One particularly useful fact about multiple
interpreters, however, is that they have separate sys modules, and
therefore separate sys.modules and sys.path. This makes them ideal for
separating web applications (and their dependencies) from one another,
which is no doubt why mod_python uses them.
Anyway, it isn't necessary to change sys.path to execfile a startup
script. It probably makes more sense to simply allow specifying any
additions to sys.path that an application needs, leaving it up to the user
to address version conflicts and the like. (Though the server could warn
that there were same-named modules or packages supplied by different
applications' sys.path additions.)
IMO, the long term solution is the multi-interpreter API, though. While
Java programmers complain of "classpath hell", in Python we should be so
lucky as to be able to have the code loaded multiple times.
More information about the Web-SIG