Python get class name
<p>So i have this problem, i want to get the name of a python class in this way:</p>

<pre><code>class TestClass():
    myName = (get class name here automatically)
    saveDirectory = os.path.join(saveDir, myName) # so i can save it in unique location
    def __init__(self):
        pass # do something
</code></pre>

<p>However, it seems that <code>__class__.__name__</code> doesn't actually exist as of yet at the time when <code>myName</code> is created. So i have been forced to put that into the <code>__init__()</code> function, like this:</p>

<pre><code>class TestClass():
    def __init__(self):
        self.myName = self.__class__.__name__
        saveDirectory = os.path.join(saveDir, self.myName) # so i can save it in unique location
        pass # do something
</code></pre>

<p>But this has a big problem, because I cannot get the name of the class until I instantiate the class, I instend to create a few gigabytes of data for each instance of the class to be saved in the saveDirectory, so it can be re-used later. So I don't actually want to do go ahead with my current solution.</p>

<p>Is there anyway to get the class name as I have intended? Or am I just dreaming?</p>

<p>EDIT:</p>

<p>Thanks guys for your great suggestions. I am going to spend a little bit of time taking a look at Metaclasses. Otherwise, I will probably create a dictionary globally, and have references to these instantiated classes instead.</p>
