How list every item of dir(object)?
<p>In Python, to find all attributes, there is:</p>

<pre><code>dir(object)

object.__dict__.keys()
</code></pre>

<p>But what i want is to list what is in the second branch, not only the first branch, it's kind of a recursive operation?</p>

<p>How to do that?</p>

<p>it's like</p>

<pre><code>dir(dir(x) for x in dir(math))
</code></pre>

<p>tried this and still get the same result duplicated:</p>

<pre><code>&gt;&gt;&gt; for i in dir(math):
...     for j in i:
...         print dir(j)
</code></pre>

<p>and all results are the methods of <code>str</code></p>

<p>Update: it seems that the <code>dir()</code> commande returns a list of <code>str</code>, here is a simple hack; I tried to exclude the <code>reserved names</code> to see if i go further, but the result was only <code>str</code></p>

<pre><code>[i for i in dir(math) if i[0]!="_"]

[type(i) for i in dir(math) if i[0]!="_"]
</code></pre>

<p>Thank you again :)</p>
