Python dir(dict) vs dir(dict.__class__)
<p>What is the difference between <code>dir(x)</code> and <code>dir(x.__class__)</code>? The latter returns a different list of attributes, but that overlaps with the former.</p>

<p>For example, SQLAlchemy's <code>sqlalchemy.create_engine()</code> function creates a new <code>Engine</code> instance. When I call <code>dir(engine)</code> (assuming <code>engine</code> is the var pointing to the appropriate instance) I get the following list returned:</p>

<pre><code>['__class__', '__delattr__', '__dict__', '__doc__', '__format__',
'__getattribute__', '__hash__', '__init__', '__module__', '__new__',
'__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__',
'__str__', '__subclasshook__', '__weakref__', '_connection_cls', '_echo',
'_execute_clauseelement', '_execute_compiled', '_execute_default',
'_execution_options', '_has_events', '_run_visitor', '_should_log_debug',
'_should_log_info', 'connect', 'contextual_connect', 'create', 'dialect',
'dispatch', 'dispose', 'driver', 'drop', 'echo', 'engine', 'execute', 'func',
'has_table', 'logger', 'logging_name', 'name', 'pool', 'raw_connection',
'reflecttable', 'run_callable', 'scalar', 'table_names', 'text', 'transaction',
'update_execution_options', 'url']
</code></pre>

<p>Calling <code>dir(engine.__class__)</code> results in the following:</p>

<pre><code>['__class__', '__delattr__', '__dict__', '__doc__', '__format__',
'__getattribute__', '__hash__', '__init__', '__module__', '__new__',
'__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__',
'__str__', '__subclasshook__', '__weakref__', '_connection_cls',
'_execute_clauseelement', '_execute_compiled', '_execute_default',
'_execution_options', '_has_events', '_run_visitor', '_should_log_debug',
'_should_log_info', 'connect', 'contextual_connect', 'create', 'dispatch',
'dispose', 'driver', 'drop', 'echo', 'execute', 'func', 'has_table',
'logging_name', 'name', 'raw_connection', 'reflecttable', 'run_callable',
'scalar', 'table_names', 'text', 'transaction', 'update_execution_options']
</code></pre>

<p>There's overlap between these two results, but also differences and I haven't found anything especially useful in the documentation that explains the difference and why.</p>
