multiple namespaces within a single module?

jkn jkn_gg at nicorp.f9.co.uk
Thu Feb 9 19:32:35 CET 2012


Hello there

    is it possible to have multiple namespaces within a single python
module?

I have a small app which is in three or four .py files. For various
reasons I would like to (perhaps optionally) combine these into one
file. I was hoping that there might be a simple mechanism that would
let me do this and maintain the namespaces referred to: so that the
'combined' file would look something like

#
# not real python
#

# originally from a.py
with namespace a:
    def function():
        pass

# ...

# originally from b.py
with namespace b:
    def function():
        pass

# originally from main module

a.function()
b.function()

etc.

Is there anything like this available?

    Thanks
    J^n




More information about the Python-list mailing list