module name vs '.'
Terry Reedy
tjreedy at udel.edu
Mon Jun 18 14:56:13 EDT 2012
On 6/18/2012 9:54 AM, Dave Angel wrote:
> On 06/18/2012 09:47 AM, Neal Becker wrote:
>> I meant a module
You are correct that using periods in a module name conflicts with
periods in import statement syntax.
> from src.directory import neal
>
> that has nothing to do with periods being in a directory name. That
> period in the source code separates a package name from a module name,
> and will not find a package named "src.directory"
So one would have to *not* use import statement syntax, but use lower
level facilities, such as importlib or (untested)
neal = __import__('src.directory', <other args>)
Conclusion: putting periods in the name of module files (including
directories) except for .py- extensions, is generally a bad idea.
--
Terry Jan Reedy
More information about the Python-list
mailing list