self.__class__.__name__ represents the name of the class : Self : Class PYTHON TUTORIALS


PYTHON TUTORIALS » Class » Self »

 

self.__class__.__name__ represents the name of the class


class FooClass(object):
  version = 0.1           
  def __init__(self, nm='John Doe'):
         self.name = nm      
         print'Created a class instance for', nm
  def showname(self):
         print 'Your name is', self.name
         print 'My name is', self.__class__.__name__
  def showver(self):
         print self.version  
  def addMe2Me(self, x):  
         return x + x

foo1 = FooClass()
foo1 = FooClass('Jane Smith')
foo1.showname()



Leave a Comment / Note


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


PYTHON TUTORIALS

 Navioo Class
» Self