Re: How to import only one module in a package when the package __init__.py has already imports the modules?
by Robert Kern other posts by this author
Oct 31 2009 9:34PM messages near this date
Re: How to import only one module in a package when the package __init__.py has already imports the modules?
|
Re: How to import only one module in a package when the package __init__.py has already imports the modules?
Peng Yu wrote:
> On Sat, Oct 31, 2009 at 10:35 PM, Robert Kern <robert.kern@[...].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.
--
Robert Kern
"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
--
http://mail.python.org/mailman/listinfo/python-list
Thread:
Duncan Booth
Peng Yu
Steven D'Aprano
Peng Yu
Steven D'Aprano
Robert Kern
Steven D'Aprano
Peng Yu
Robert Kern
Steven D'Aprano
Peng Yu
Steven D'Aprano
Peng Yu
Robert Kern
Peng Yu
Robert Kern
Steven D'Aprano
Peng Yu
Steven D'Aprano
Peng Yu
Robert Kern
Peng Yu
Robert Kern
Wolodja Wentland
Peng Yu
Dave Angel
Peng Yu
Wolodja Wentland
Peng Yu
Robert Kern
|