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


Groups > comp.lang.python > #81854 > unrolled thread

Re: Style question: Importing modules from packages - 'from' vs 'as'

Started byChris Angelico <rosuav@gmail.com>
First post2014-12-03 22:33 +1100
Last post2014-12-03 22:33 +1100
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Style question: Importing modules from packages - 'from' vs 'as' Chris Angelico <rosuav@gmail.com> - 2014-12-03 22:33 +1100

#81854 — Re: Style question: Importing modules from packages - 'from' vs 'as'

FromChris Angelico <rosuav@gmail.com>
Date2014-12-03 22:33 +1100
SubjectRe: Style question: Importing modules from packages - 'from' vs 'as'
Message-ID<mailman.16529.1417606395.18130.python-list@python.org>
On Wed, Dec 3, 2014 at 10:27 PM, Peter Otten <__peter__@web.de> wrote:
> Don't repeat yourself, so
>
> from os import path
>
> always. On the other hand I have never thought about actual renames, e. g.
>
> from os import path as stdpath
>
> versus
>
> import os.path as stdpath
>
> I think I'd use the latter as it looks simpler.

Thanks, Peter and Tim. Keeping DRY is worth doing (the more so as it's
raining as I type this...), and I won't be renaming in this, so the
from-import wins - but as Tim says, it's a close race.

I do like the turn-around times on this list. Although, of course,
it's entirely possible there'll be a week's worth of posts coming when
someone hits on a controversial subaspect of the question somewhere;
any volunteers? :) :)

ChrisA

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web