In <mailman.809.1251832870.2854.python-l...@python.org> "Rami Chowdhury" <rami.chowdh...@gmail.com> writes:
>> An implication of all this is that if now I wanted to create a new >> module x.y.z.w, this means that the previously "leaf"-module x.y.z >> would become "non-leaf". In other words, I'd have to: >> >> 1. create the new directory x/y/z >> 2. *rename* the file x/y/z.py to x/y/z/__init__.py >> 3. create the file x/y/z/w.py to hold the source for the new x.y.z.w >> module >With regard to point 2 -- would it be possible to just move z.py into >x/y/z, and put 'from z import *' into x/y/z/__init__.py, for the same >effect? Or is that not a good idea? I think in this case what you would need is something like 'from ..z import *', but this does not work either; one gets the error "SyntaxError: 'import *' not allowed with 'from .'". A third solution would be to change step 2 above to this: 2. create the *symlink* x/y/z/__init__.py --> ../z.py This certainly would make things clearer-looking to me. Having all these files called the same thing, __init__.py, but having completely different meaning, makes my head hurt... In contrast, the __init__.py *symlinks* would be there just to keep python happy; the real content is where I'd expect it. I ran a simple test of this idea and it works, but there may be some subtle reasons for not doing it... Or maybe it's not a good idea simply because it is not the Python way, and I'd agree that this would be reason enough to avoid it. kynn -- http://mail.python.org/mailman/listinfo/python-list