How to import only one module in a package when the package __init__.py has already imports the modules?

Peng Yu pengyu.ut at gmail.com
Sat Oct 31 23:54:47 EDT 2009


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



More information about the Python-list mailing list