<p>I apologize in advance if this question seems remedial.</p>

<p>Which would be considered more efficient in Python:</p>

<p><strong>Standard import</strong></p>

<pre><code>import logging

try:
  ...some code...
exception Exception, e:
  logging.error(e)
</code></pre>

<p>...or...</p>

<p><strong>Contextual import</strong></p>

<pre><code>try:
  ...some code...
exception Exception, e:
  import logging
  logging.error(e)
</code></pre>

They're essentially the same. The Python interpreter will only load a used module
once
, no matter how many times you import it. Changing the location of the import statement only has an effect on where the name is bound -- for example, if your
```
import
```
statement is inside a function, the name can only be used in that function.
Generally, though, imports are usually done as close to the "top" of a file as possible.