title: How can I get a list of the symbols in a sympy expression?
body: <p>For example, if I run</p>
  
  <pre><code>import sympy
  x, y, z = sympy.symbols('x:z')
  f = sympy.exp(x + y) - sympy.sqrt(z)
  </code></pre>
  
  <p>is there any method of <code>f</code> that I can use to get a list or tuple of <code>sympy.Symbol</code> objects that the expression contains? I'd rather not have to parse <code>srepr(f)</code> or parse downward through <code>f.args</code>.</p>
  
  <p>In this case, <code>g.args[0].args[1].args[0]</code> gives me <code>Symbol("z")</code>, while <code>g.args[1].args[0].args</code> gives me the tuple <code>(Symbol("x"), Symbol("y"))</code>, but obviously these are expression-specific.</p>