import syntax

Dave Angel davea at davea.name
Mon Jul 29 16:09:18 EDT 2013


On 07/29/2013 03:48 PM, Devyn Collier Johnson wrote:
> The PEP8 recommends importing like this:
>
> import os
> import re
>
> not like this:
>
> import os, re
>
> Why is that? Is there a performance advantage to one of the styles?
>
>

Pep 8 is not about performance, it's about readability.  And unless the 
two libraries are closely related, it's clearer to use separate lines 
for them.

I got a bit further, and if I'm only using a couple of functions from 
the import, I'll list them in the comment.

-- 
DaveA




More information about the Python-list mailing list