title: How can I get a list of all classes within current module in Python?
body: <p>I've seen plenty of examples of people extracting all of the classes from a module, usually something like:</p>
  
  <pre><code># foo.py
  class Foo:
      pass
  
  # test.py
  import inspect
  import foo
  
  for name, obj in inspect.getmembers(foo):
      if inspect.isclass(obj):
          print obj
  </code></pre>
  
  <p>Awesome.</p>
  
  <p>But I can't find out how to get all of the classes from the <em>current</em> module.</p>
  
  <pre><code># foo.py
  import inspect
  
  class Foo:
      pass
  
  def print_classes():
      for name, obj in inspect.getmembers(???): # what do I do here?
          if inspect.isclass(obj):
              print obj
  
  # test.py
  import foo
  
  foo.print_classes()
  </code></pre>
  
  <p>This is probably something really obvious, but I haven't been able to find anything. Can anyone help me out?</p>