title: Dynamically get class name at class level variable in python
body: <p>The question is straightforward and I have tried to make the indentation proper for readability. I am just starting of with Python and here is what I have now:</p>
  
  <pre><code>class BaseKlass():
    ....
  
  class DerivedKlass1(BaseKlass):
    display_name = "DerivedKlass1"
  
  class DerivedKlass2(BaseKlass):
    display_name = "DerivedKlass2"
  </code></pre>
  
  <p>So basically all derived classes has </p>
  
  <blockquote>
    <p>display_name variable with class name hardcoded.</p>
  </blockquote>
  
  <p>What I want is to have display_name set in the BaseKlass and remove the display_name declaration from the child classes as follows:</p>
  
  <pre><code>class BaseKlass():
    display_name = &lt;some way to set the display name to callee class name&gt;
  
  class DerivedKlass1(BaseKlass):
    ....
  
  class DerivedKlass2(BaseKlass):
    ....
  </code></pre>
  
  <p>So that DerivedKlass1.display_name should return "DerivedKlass1" and DerivedKlass2.display_name should return "DerivedKlass2".</p>
  
  <p>I know I am missing something very obvious and I am expecting a lot of RTFM comments but regardless all I want is to learn how to dynamically set python class name to a class level attribute. So feel free to down vote the post if you would like to but I will be thankful if you  leave an answer as well.</p>
  
  <p>Thanks,</p>