migrating to packages

Gerardo Herzig gherzig at fmed.uba.ar
Fri Oct 5 10:00:11 EDT 2007


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, rigth?
>>    
>>
>
>Why so ?
>
>  
>
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, since a particular program can use 1,2, 
or 3 classes at the time....Thats why im watching the way to override 
the `import statement'.......

Damn client code!!!

Gerardo



More information about the Python-list mailing list