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


Groups > comp.lang.python > #51487

Re: import syntax

Date 2013-07-29 15:20 -0500
From Tim Chase <python.list@tim.thechases.com>
Subject Re: import syntax
References <51F6C720.2020404@Gmail.com> <kt6i57$2ku$1@ger.gmane.org>
Newsgroups comp.lang.python
Message-ID <mailman.5263.1375129166.3114.python-list@python.org> (permalink)

Show all headers | View raw


On 2013-07-29 16:09, Dave Angel wrote:
> 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
>
> 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.

If I just plan to use a small subset, I tend to reach for the

  from sys import stdout, stderr, exit

sort of syntax.  I find it makes my code read a bit more cleanly than
having to type "sys.stderr.write(...)" everywhere but is still pretty
readable.

-tkc

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


Thread

Re: import syntax Tim Chase <python.list@tim.thechases.com> - 2013-07-29 15:20 -0500

csiph-web