migrating to packages

gherzig at fmed.uba.ar gherzig at fmed.uba.ar
Thu Oct 4 03:28:57 CEST 2007

> On Oct 3, 2007, at 11:42 AM, Gerardo Herzig wrote:
>> Hi all. I have a single file with several classes, wich i want to
>> separate into several packages.
>> The big file is named, say MYCLASES, and contains a class named
>> A(object), and B(A).
>> We have been using this MYCLASES in the
>> from MYCLASES import B syntax, but i cant reproduce this syntax using
>> packages. Im forced to write from PACKAGE.B import *, and if that
>> means
>> i have to touch so many files, that would really be a problem to me.
>> There is (i cant find it yet) a place where i can read about that kind
>> of package 'migration' situation?
>> Because i *really* want to keep the FROM PACKAGE import B syntax.
> http://www.python.org/doc/current/tut/
> node8.html#SECTION008400000000000000000
I have already read those files (and i just read it again), but still cant
find the solution. Maybe i just do not explain myself in the correct way
(or  i am very very stupid :)
I will expose my case quicly.
The MYCLASES.py file contains the A class, so i can use
from MYCLASES import A
a = ()

Using the "package mode" (wich looks fine BTW), having the simple

forces my (i guess) to use the
from MYCLASES.A import A

which is not what i want, because the big amount of files i will have to
modify (and im not alones, there is a group of dudes who use this

Im i missing something in that docs you post?


More information about the Python-list mailing list