Set properties when constructed : Constructor : Class PYTHON TUTORIALS


PYTHON TUTORIALS » Class » Constructor »

 

Set properties when constructed


class C1():
    def __init__(self, who):    
        self.name = who         

I1 = C1('bob')                  
I2 = C1('mel')                  
print I1.name



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON TUTORIALS

 Navioo Class
» Constructor