What is module initialization?

dudeja.rajat at gmail.com dudeja.rajat at gmail.com
Tue Sep 2 15:32:30 CEST 2008


I found on the net that there is something called module
initialization. Unfortunately, there is not much information for this.
However, small the information I found module initialization can be of
use to me in my project.

I'm currently messing with a problem where I'm keeping my global
variables ( or symbols) in a module and the other mdoules in the
project acess these global variables.

However, there is one case when a module updates one such global
variable but the variable is not getting updated in the module
containing global symbols ( variables). This happen only at the start
of the program and at rest of the places in the program that global
variable is not accessed.

So, I thought of using this module initialization where I will
intialize the module only once to update that variable. Ans in the
rest of the program where ever this module is imported I shall be able
to easily access the update value of the variable.

Could some one provide me a sample code of module intialization? And
how can I ensure that module initialization is done only once?

Thanks and regards,

More information about the Python-list mailing list