Let us make our example more useful by giving P some attributes : Attribute : Class PYTHON TUTORIALS


PYTHON TUTORIALS » Class » Attribute »

 

Let us make our example more useful by giving P some attributes


class P:         
    "P's doc string"
    def __init__(self):
        print 'created an instance of', self.__class__.__name__

class C(P):      
    pass

p = P()                       
print p.__class__           
print P.__bases__           
print P.__doc__             

c = C()            
print c.__class__  
print C.__bases__  
print C.__doc__



Leave a Comment / Note


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


PYTHON TUTORIALS

 Navioo Class
» Attribute