<div dir="ltr">On 29 July 2013 21:23, Devyn Collier Johnson <span dir="ltr"><<a href="mailto:devyncjohnson@gmail.com" target="_blank">devyncjohnson@gmail.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5"><br>
On 07/29/2013 04:20 PM, Tim Chase wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On 2013-07-29 16:09, Dave Angel wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On 07/29/2013 03:48 PM, Devyn Collier Johnson wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
The PEP8 recommends importing like this:<br>
<br>
import os<br>
import re<br>
<br>
not like this:<br>
<br>
import os, re<br>
</blockquote>
I got a bit further, and if I'm only using a couple of functions<br>
from the import, I'll list them in the comment.<br>
</blockquote>
If I just plan to use a small subset, I tend to reach for the<br>
<br>
from sys import stdout, stderr, exit<br>
<br>
sort of syntax. I find it makes my code read a bit more cleanly than<br>
having to type "sys.stderr.write(...)" everywhere but is still pretty<br>
readable.<br>
<br>
-tkc<br>
<br>
<br>
</blockquote></div></div>
So, there are no advantages or disadvantages when disregarding readability?</blockquote><div><br></div><div>Sure, just as one light is no brighter or dimmer than another when disregarding luminosity.</div><div><br>As people have said, it improves diffs as well. It flows quicker into the "from module import things" form (which I oft prefer), too.</div>
<div><br></div><div>When asking these questions, ask yourself "why would it *compile* differently? It wouldn't. Plus, premature optimisation is the root of all evil.</div><div><br></div><div>1) Write your code</div>
<div>2) If it's slow:</div><div>2a) Do you have time? If so:</div><div>2b) Is it important to speed up, or is the slowness not worth spending the hours fixing?</div><div>2c) Profile it to see what's actually slow</div>
<div>2d) Realise that the slow part is not what you thought it was</div><div>2e) Fix the bit that's slow (and nothing else)</div><div>2f) Repeat from 2</div><div>3) Write some more code</div></div></div></div>