What are all the ways to add an object to the local scope in Python?
<pre><code>my_var = 3
assert('my_var' in locals())

import a_module
assert('a_module' in locals())

from sys import *
assert('stdin' in locals())
</code></pre>

<p>I also think you can inject with calls to <code>locals()</code> and <code>globals()</code>?</p>

<p>Anyway, I love python because it's so explicit with imports. If a name is used, you can usually trace back to exactly where that name was defined. But, I've recently been running into modules wherein I want to find where the name <code>qux</code> is defined. The module itself contains no <code>from something import *</code>, no <code>locals</code> or <code>globals</code>, but when I CTRL+F for that name I find it only on the RHS of expressions, nowhere defined!</p>

<p>So my question is this: what are all the mechanisms by which a name can enter the local namespace? Can normal imports inject into my local namespace? </p>
