title: Getting an instance name inside class __init__()
body: <p>While building a new class object in python, I want to be able to create a default value based on the instance name of the class without passing in an extra argument. How can I accomplish this? Here's the basic pseudo-code I'm trying for:</p>
  
  <pre><code>class SomeObject():
      defined_name = u""
  
      def __init__(self, def_name=None):
          if def_name == None:
              def_name = u"%s" % (&lt;INSTANCE NAME&gt;)
          self.defined_name = def_name
  
  ThisObject = SomeObject()
  print ThisObject.defined_name   # Should print "ThisObject"
  </code></pre>