Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #51485

Re: import syntax

From Dave Angel <davea@davea.name>
Subject Re: import syntax
Date 2013-07-29 16:09 -0400
References <51F6C720.2020404@Gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.5261.1375128578.3114.python-list@python.org> (permalink)

Show all headers | View raw


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

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: import syntax Dave Angel <davea@davea.name> - 2013-07-29 16:09 -0400

csiph-web