Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news.stack.nl!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.026 X-Spam-Evidence: '*H*': 0.95; '*S*': 0.00; "subject:' ": 0.07; 'os.path': 0.09; 'subject:modules': 0.09; 'violates': 0.09; 'subject:question': 0.10; "wouldn't": 0.14; 'wrote:': 0.18; 'import': 0.22; 'email addr:gmail.com>': 0.22; 'to:name:python- list@python.org': 0.22; 'header:In-Reply-To:1': 0.27; 'chris': 0.29; 'leave': 0.29; 'tim': 0.29; 'message-id:@mail.gmail.com': 0.30; 'code': 0.31; "i'd": 0.34; 'subject:from': 0.34; 'december': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'list': 0.37; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'either': 0.39; 'personal': 0.63; 'different': 0.65; 'repeat': 0.74; 'dry': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=7dFgIPcCdbxteL6Ck9SHv+gONfAP8LRbYZrLjiGfrHY=; b=WjWre6hqtMcj9lN8uvGcVs3nOJTUu5h+UTWonV+xRbMk2WwnWnkYX2fTX2PF3skkHz XsQosFDkDZmyC+ds6FsjbG6jcK3BGgnseLY/1LqVHhTVrnGr5XpWQ/RL7+Jm6JZ+nYSI n3RQxbjVa5LDyfgqo5tyAColGC9VODFe0O1jCDXJCpc/+oQJ1eljIhAO/MbYqCdN96vu jnT21HgYzmzyGpYQ43IamMIuQvJF4hDP8MEsJoX+1wgrVWuRpCf3d6N0fZ/W7xBXLJjB U7F6pciJRQwFnxE5OhBMS+BovK9TECdRXhO+O5kpwnI7NMPD1myjwFLj85kWceO5guj/ OtKQ== MIME-Version: 1.0 X-Received: by 10.180.82.98 with SMTP id h2mr12763846wiy.7.1417605319118; Wed, 03 Dec 2014 03:15:19 -0800 (PST) In-Reply-To: References: Date: Wed, 3 Dec 2014 22:15:19 +1100 Subject: Re: Style question: Importing modules from packages - 'from' vs 'as' From: Tim Delaney To: "python-list@python.org" Content-Type: multipart/alternative; boundary=f46d044283ec7a586b05094df5d5 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 45 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1417605326 news.xs4all.nl 2913 [2001:888:2000:d::a6]:50847 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:81851 --f46d044283ec7a586b05094df5d5 Content-Type: text/plain; charset=UTF-8 On 3 December 2014 at 22:02, Chris Angelico 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 --f46d044283ec7a586b05094df5d5 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
On 3= December 2014 at 22:02, Chris Angelico <rosuav@gmail.com> wr= ote:

import os.path as path
from os import path

Bah - deleted the l= ist and sent directly to Chris ... time to go to bed.

<= div style=3D"font-family:arial,sans-serif;font-size:13px">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 margi= nal that I'd leave it to personal preference, and wouldn't pull som= eone up for either in a code review.

Tim De= laney=C2=A0
--f46d044283ec7a586b05094df5d5--