Package name with '.' in them: Python Bug ?

Stewart Midwinter stewart at midwinter.ca
Fri Mar 19 16:07:49 EST 2004


Yannick Patois <patois at calvix.org> wrote in message news:<c3f1ac$n29$1 at sunnews.cern.ch>...
> If now I just *rename* file B to B.1, without any change in the code 
> (except name='B' become name='B.1' in aTest.py), content of B.1.py file 
> being exacty the same as content of B.py, I get:
> 
....

> Any idea ? Is it well a bug ? Some feature I didnt understood ? I read 
> about submodule naminig using dots as separator, but I cant relate it 
> towhat I saw here.

Salut Yannick:

J'ose offrir une réponse....

I work with submodules.  They're in some folder, which has subfolders
(call them fbm, uti, and a few others).  If I place an empty file in
my root folder called __init__.py, I can refer to modules in the
subfolders by a dot notation.  For example, if I have a file
process.py in subfolder fbm, I can say:
import fbm.process

I speculate that when you renamed B to B.1, Python interpreted your
intent to import a module called 1 in subfolder B.

J'espère que cela aide un peu!

Stewart



More information about the Python-list mailing list