How to import only one module in a package when the package __init__.py has already imports the modules?
robert.kern at gmail.com
Sun Nov 1 05:09:05 CET 2009
Peng Yu wrote:
> On Sat, Oct 31, 2009 at 10:35 PM, Robert Kern <robert.kern at gmail.com> wrote:
>> Peng Yu wrote:
>>> I have defined 'long' in one of my previous message. I consider a file
>>> long, when it does not fit in one or two screen. Basically, I want to
>>> get a whole picture of the file after glancing of the file.
>> I think you are going to have to get used to the fact that you have very
>> strange personal preferences and that Python is designed for the vast
>> majority of programmers who do not share them.
> So python would not be able to accommodate my preference one
> class/function per file? I.e., I have to use something like 'from spam
> import spam' or 'spam.spam()', or accept that the filename is not the
> same as the class/function name.
> Inside test/__init__.py:
> from a import A # class A from file a.py
> from b import B # class B from file b.py
If you are going to expose symbols in your __init__.py, they should not have the
same name as any of the modules in the package.
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
More information about the Python-list