title: How to avoid lookup overhead in python with full-qualified names to avoid circular imports problems
body: <p>To avoid circular imports, one can use <code>import x</code> and then use <code>x.func</code> each time.  (cf. <a href="https://stackoverflow.com/questions/744373/circular-or-cyclic-imports-in-python">Circular (or cyclic) imports in Python</a> ). (In my case, I have no other choice actually)</p>
  
  <p>However, when <code>x</code> is for example <code>a.b.c.d.e</code>, then you get a non-negligible overhead (in addition to the readability problems), especially if your function is called repetitively. I would like to know if there is some kind of mechanism to define shortcuts like <code>E = a.b.c.d.e</code> when the imports are resolved ? (or something to avoid the lookup eachtime)</p>
  
  <p>Note : on pypy, there is no performance differences but on CPython, you can get ×2 improvement between <code>a.A()</code> and <code>a.b.c.d.e.f.g.h.A()</code></p>
  
  <p><strong>EDIT</strong>
  about the <code>import ... as ...</code> solution,
  this is the trace I get (I think it will be clearer than any explication I could give) :</p>
  
  <pre><code>  File "MyApp/__init__.py", line 3, in &lt;module&gt;
      import MyApp.core
    File "MyApp/core.py", line 3, in &lt;module&gt;
      import MyApp.formatters.ASCIIFormatter as _F
    File "MyApp/formatters/__init__.py", line 2, in &lt;module&gt;
      import MyApp.formatters.ASCIIFormatter as ASCIIFormatter
    File "MyApp/formatters/ASCIIFormatter.py", line 2, in &lt;module&gt;
      import MyApp.core as _C
  AttributeError: module 'MyApp' has no attribute 'core'
  </code></pre>