class too big for one file! How can I split it?

Lee Harr missive at frontiernet.net
Thu Apr 10 19:19:19 EDT 2003


In article <e956b5f1.0304100512.597654d3 at posting.google.com>, HHaegele wrote:
> Hello,
> I have the following structure:
> 
>===============
> ot_starter.py :
> ---------------
> 
> import OTLib
> 
> ot = OTLib.Ot(A, E)
> 
> ot.Att()
> 
> ot.Btt()
> 
> ---------------
> 
> 
>===============
> OTLib.py :
> ---------------
> 
> XX = None
> 
> class Ot(a, e):
> 
>     def __init__(self, a = None, e = None):
>         global XX
>         XX = e    
>        
>     def Att(self):
>         global XX
>         print XX
>         ...
>         
> ---------------
> 
> Now, OTLib.py has more then 32000 lines. And that doesn´t work. Python
> 1.5 can´t execute then. So, how can I add the method Btt()? How can I
> make another file, which knows the global XX and who can be handled
> from the ot_starter, like it is in one file? Good would also be, if
> the Btt() can access XX the same way like Att() can. Is that possible?
> Or how must I change the structure?
> 


How about a subclass?

=================
OTLib1.py :
-----------------

import OTLib

class Ot(OTLib.Ot):
    def Btt(self):
        ...






More information about the Python-list mailing list