Twice instanciation

Salvatore artyprog at wanadoo.fr
Fri Jun 13 19:20:24 CEST 2003


anton muhin wrote:

> Salvatore wrote:
> 
>> 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
>>
> 
> Bindings class might be of help (see 
> http://www-106.ibm.com/developerworks/linux/library/l-prog2.html for 
> more details).
> 
> hth,
> anton.
> 
That's exactly what I wanted :-)

Thank you very much Anton





More information about the Python-list mailing list