Modifying Class Attributes : Attribute : Class PYTHON TUTORIALS


PYTHON TUTORIALS » Class » Attribute »

 

Modifying Class Attributes


class counter: 
    count = 0                            
    def __init__(self)
        self.__class__.count += 1             

counter 
print counter.count                                
c = counter() 
print c.count                                        
print counter.count 
d = counter()                                    
print d.count 
print c.count 
print counter.count



Leave a Comment / Note


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


PYTHON TUTORIALS

 Navioo Class
» Attribute