Twice instanciation

Salvatore artyprog at wanadoo.fr
Thu Jun 12 21:35:11 CEST 2003


Hello,

Is it possible to avoid twice instanciation
of the same variable ?

class Global:
    def __init__(self,init=0):
       self.value = init

g = Global() #instanciating one time ok
g = Global() #instanciating two times would raise an exception


Regards

Salvatore





More information about the Python-list mailing list