is this a valid import sequence ?

Stef Mientki S.Mientki-nospam at mailbox.kun.nl
Fri Jun 22 21:43:40 CEST 2007


This might be a very weird construction,
but it's the most easy way in translating another language into Python (for simulation).

Although it works, I like to know if this a valid construction:

I've defined a class, like this,
attaching a not yet defined global to itself

class T6963_device (tDevice):
     def __init__ (self):
         global LCD
         LCD = self


In the same module I've a function,
that runs a method of the above class instance,
and uses the global defined in the init of the class

def Write_LCD_Data ( data ):
     global LCD
     LCD.Write_Data ( data )

In another module a create one and only one instance of the class,
in the normal way:

   Graphical_LCD = T6963_device('', Pos=[196,240], Color=wx.CYAN, Timer_On=True)


thanks
Stef Mientki



More information about the Python-list mailing list