Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #20157
| From | Peter Otten <__peter__@web.de> |
|---|---|
| Subject | Re: multiple namespaces within a single module? |
| Date | 2012-02-10 12:10 +0100 |
| Organization | None |
| References | <6f50fa3d-74e6-4682-b5d8-2634d418dd23@d15g2000yqg.googlegroups.com> <mailman.5606.1328816021.27778.python-list@python.org> <2caddc2a-f412-49bc-b02e-d475bc6db8a0@s13g2000yqe.googlegroups.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.5652.1328872247.27778.python-list@python.org> (permalink) |
jkn wrote: > Hi Peter > > On Feb 9, 7:33 pm, Peter Otten <__pete...@web.de> wrote: >> jkn wrote: >> > is it possible to have multiple namespaces within a single python >> > module? >> >> Unless you are abusing classes I don't think so. >> >> > 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. >> >> Rename your main script into __main__.py, put it into a zip file together >> with the other modules and run that. > > Hmm ... thanks for mentioning this feature, I didn't know of it > before. Sounds great, except that I gather it needs Python >2.5? I'm > stuck with v2.4 at the moment unfortunately... You can import and run explicitly, $ PYTHONPATH mylib.zip python -c'import mainmod; mainmod.main()' assuming you have a module mainmod.py containing a function main() in mylib.zip.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
multiple namespaces within a single module? jkn <jkn_gg@nicorp.f9.co.uk> - 2012-02-09 10:32 -0800
Re: multiple namespaces within a single module? Peter Otten <__peter__@web.de> - 2012-02-09 20:33 +0100
Re: multiple namespaces within a single module? jkn <jkn_gg@nicorp.f9.co.uk> - 2012-02-09 15:24 -0800
Re: multiple namespaces within a single module? Peter Otten <__peter__@web.de> - 2012-02-10 12:10 +0100
Re: multiple namespaces within a single module? jkn <jkn_gg@nicorp.f9.co.uk> - 2012-02-10 08:28 -0800
Re: multiple namespaces within a single module? Ethan Furman <ethan@stoneleaf.us> - 2012-02-09 13:12 -0800
Re: multiple namespaces within a single module? Peter Otten <__peter__@web.de> - 2012-02-09 22:53 +0100
Re: multiple namespaces within a single module? Ethan Furman <ethan@stoneleaf.us> - 2012-02-09 14:25 -0800
Re: multiple namespaces within a single module? Ethan Furman <ethan@stoneleaf.us> - 2012-02-09 16:05 -0800
Re: multiple namespaces within a single module? Arnaud Delobelle <arnodel@gmail.com> - 2012-02-10 10:41 +0000
csiph-web