title: 'from X import a' versus 'import X; X.a'
body: <p>I've seen some Python programmers use the following style fairly consistently (we'll call it style 1):</p>
  
  <pre><code>import some_module
  # Use some_module.some_identifier in various places.
  </code></pre>
  
  <p>For support of this style, you can cite the <a href="http://www.python.org/dev/peps/pep-0020/" rel="nofollow noreferrer">"explicit is better than implicit"</a> maxim. I've seen other programmers use this style (style 2):</p>
  
  <pre><code>from some_module import some_identifier
  # Use some_identifier in various places.
  </code></pre>
  
  <p>The primary benefit that I see in style 2 is maintainability -- especially with <a href="http://en.wikipedia.org/wiki/Duck_typing" rel="nofollow noreferrer">duck typing</a> ideals I may want to swap some_module for some_other_module. I also feel style 2 wins points with the <a href="http://www.python.org/dev/peps/pep-0020/" rel="nofollow noreferrer">"readability counts"</a> maxim. Although I tend to disagree, one can always argue that search-and-replace is just as good an option when using the first style.</p>
  
  <p><strong>Addendum:</strong> It was noted that you could use <code>as</code> to solve the switch from <code>some_module</code> to <code>some_other_module</code> in style 1. I forgot to mention that it is also common to decide to implement <code>some_identifier</code> in your <em>current</em> module, which makes creation of an equivalent <code>some_module</code> container slightly awkward.</p>