title: How can I obtain the full AST in Python?
body: <p>I like the options offered by the <b>_ast</b> module, it's really powerful. Is there a way of getting the full AST from it? </p>
  
  <p>For example, if I get the AST of the following code :</p>
  
  <pre><code>import os
  os.listdir(".")
  </code></pre>
  
  <p>by using :</p>
  
  <pre><code>ast = compile(source_string,"&amp;lt;string&amp;gt;","exec",_ast.PyCF_ONLY_AST)
  </code></pre>
  
  <p>the body of the <b>ast</b> object will have two elements, an <b>import</b> object, and a <b>expr</b> object. However, I'd like to go further, and obtain the AST of <b>import</b> and <b>listdir</b>, in other words, I'd like to make <b>_ast</b> descend to the lowest level possible. </p>
  
  <p>I think it's logical that this sort of thing should be possible. The question is <b>how</b>?</p>
  
  <p>EDIT: by the lowest level possible, I didn't mean accesing what's "visible". I'd like to get the AST for the implementation of <b>listdir</b> as well: like <b>stat</b> and other function calls that may be executed for it.</p>