Re: migrating to packages

2007-10-05 Thread Bruno Desthuilliers
Gerardo Herzig a écrit : > Bruno Desthuilliers wrote: > >> Gerardo Herzig a écrit : >> >> >>> Carl Bank a écrit : >>> >>> Add these lines in __init__.py: from MYCLASSES.A import A from MYCLASSES.B import B >>> >>> Ummm, that works indeed, but forces me

Re: migrating to packages

2007-10-05 Thread Hrvoje Niksic
Gerardo Herzig <[EMAIL PROTECTED]> writes: > If the original MYCLASSES.py has 5 different classes ,say A,B,C,D,E > , each one has to be imported (as A and B) in order to be used for > the client code. The thing is, there are more than 5 classes, and > looks like a lot of unnecesary work to me, sin

Re: migrating to packages

2007-10-05 Thread Gerardo Herzig
Bruno Desthuilliers wrote: >Gerardo Herzig a écrit : > > >>Carl Bank a écrit : >> >> >>>Add these lines in __init__.py: >>> >>>from MYCLASSES.A import A >>>from MYCLASSES.B import B >>> >>> >>> >>> >>Ummm, that works indeed, but forces me to import all (more than A and B) >>classes,

Re: migrating to packages

2007-10-05 Thread Bruno Desthuilliers
Gerardo Herzig a écrit : > Carl Bank a écrit : >> >> Add these lines in __init__.py: >> >> from MYCLASSES.A import A >> from MYCLASSES.B import B >> >> > Ummm, that works indeed, but forces me to import all (more than A and B) > classes, rigth? Why so ? -- http://mail.python.org/mailman/listi

Re: migrating to packages

2007-10-04 Thread Gerardo Herzig
> > > >>>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 be

Re: migrating to packages

2007-10-04 Thread Hrvoje Niksic
Bruno Desthuilliers <[EMAIL PROTECTED]> writes: >> We agree on that. It is the OP who *wants* to access his modules >> directly without ever naming the package. > > To be exact, he wants to reorganize it's source code (splitting a > file that's getting too big AFAICT) You're right, I misread his

Re: migrating to packages

2007-10-04 Thread Bruno Desthuilliers
Hrvoje Niksic a écrit : > Bruno Desthuilliers <[EMAIL PROTECTED]> writes: > >> it's quite common to use the __init__.py of the package (as >> explained by Ben) as a facade to the internal organization of the >> package, so you can change this internal organization without >> breaking client code.

Re: migrating to packages

2007-10-04 Thread Hrvoje Niksic
Bruno Desthuilliers <[EMAIL PROTECTED]> writes: > it's quite common to use the __init__.py of the package (as > explained by Ben) as a facade to the internal organization of the > package, so you can change this internal organization without > breaking client code. We agree on that. It is the OP

Re: migrating to packages

2007-10-04 Thread Bruno Desthuilliers
Hrvoje Niksic a écrit : > [EMAIL PROTECTED] writes: > >> 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 >> MYCLASES/ >> __init__.py >> A.p

Re: migrating to packages

2007-10-03 Thread Hrvoje Niksic
[EMAIL PROTECTED] writes: > 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 > MYCLASES/ > __init__.py > A.py > > forces my (i guess) to use the

Re: migrating to packages

2007-10-03 Thread Carl Banks
On Wed, 03 Oct 2007 22:28:57 -0300, gherzig wrote: >> 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),

Re: migrating to packages

2007-10-03 Thread Ben Finney
[EMAIL PROTECTED] writes: > 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 > MYCLASES/ > __init__.py > A.py > > forces my (i guess) to use the > from MYCLASES.A import A Y

Re: migrating to packages

2007-10-03 Thread gherzig
> > 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 >

Re: migrating to packages

2007-10-03 Thread Erik Jones
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 MYCL

migrating to packages

2007-10-03 Thread Gerardo Herzig
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 pa