title: Get the list of a class's variables & methods in Python
body: <p>If I have the following class, what's the best way of getting the exact list of variables and methods, <em>excluding</em> those from the superclass?</p>
  
  <pre><code>class Foo(Bar):
    var1 = 3.14159265
    var2 = Baz()
    @property
    def var3(self):
        return 42
    def meth1(self, var):
        return var
  </code></pre>
  
  <p>I want the tuple <code>('var1','var2','var3','meth1')</code> with minimum overhead.  This is being run in a Django environment, which seems to be putting some of it's class instance variables in the read-only <code>__dict__</code> variable; a feat which I can't find a way to replicate.</p>
  
  <p>Here's what I'm seeing while playing with it, any suggestions beyond trimming out the <code>__*</code> from the dir() or manually listing them?</p>
  
  <pre><code>&gt;&gt;&gt; a=Foo()
  &gt;&gt;&gt; a
  &lt;__main__.Foo instance at 0x7f48c1e835f0&gt;
  &gt;&gt;&gt; dict(a)
  Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  TypeError: iteration over non-sequence
  &gt;&gt;&gt; dir(a)
  ['__doc__', '__module__', 'meth1', 'var1', 'var2', 'var3']
  &gt;&gt;&gt; a.__dict__
  {}
  </code></pre>