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


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

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

Started byTim Delaney <timothy.c.delaney@gmail.com>
First post2014-12-03 22:15 +1100
Last post2014-12-03 22:15 +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' Tim Delaney <timothy.c.delaney@gmail.com> - 2014-12-03 22:15 +1100

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

FromTim Delaney <timothy.c.delaney@gmail.com>
Date2014-12-03 22:15 +1100
SubjectRe: Style question: Importing modules from packages - 'from' vs 'as'
Message-ID<mailman.16526.1417605326.18130.python-list@python.org>

[Multipart message — attachments visible in raw view] — view raw

On 3 December 2014 at 22:02, Chris Angelico <rosuav@gmail.com> wrote:

>
> import os.path as path
> from os import path
>

Bah - deleted the list and sent directly to Chris ... time to go to bed.

The advantage of the former is that if you want to use a different name,
it's a smaller change. But the disadvantage of the former is that if you
*don't* want to rename, it violates DRY (don't repeat yourself).

The difference is so marginal that I'd leave it to personal preference, and
wouldn't pull someone up for either in a code review.

Tim Delaney

[toc] | [standalone]


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


csiph-web