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


Groups > comp.lang.python > #36798

Re: Python modules

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!us.feeder.erje.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <rantingrickjohnson@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'exception': 0.03; 'received:209.85.223': 0.03; 'subject:Python': 0.05; 'testing,': 0.07; 'tkinter': 0.07; 'clean.': 0.09; 'lookup': 0.09; 'namespace': 0.09; 'subject:modules': 0.09; 'to:addr:comp.lang.python': 0.09; 'cc:addr:python-list': 0.10; '"from': 0.16; '"import': 0.16; 'brewing': 0.16; 'prepend': 0.16; 'programmer,': 0.16; 'wrote:': 0.17; 'module': 0.19; 'trying': 0.21; 'import': 0.21; 'cc:2**0': 0.23; 'monday,': 0.23; 'cc:no real name:2**0': 0.24; 'command': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; '[1]': 0.27; '[2]': 0.27; 'chris': 0.28; 'probably': 0.29; 'more,': 0.32; 'shorter': 0.33; 'received:google.com': 0.34; 'needed': 0.35; 'received:209.85': 0.35; 'received:209': 0.37; 'subject:: ': 0.38; 'instead': 0.39; 'performance': 0.39; 'your': 0.60; 'most': 0.61; 'fact,': 0.69; '2013': 0.84
Newsgroups comp.lang.python
Date Mon, 14 Jan 2013 08:27:56 -0800 (PST)
In-Reply-To <mailman.502.1358175849.2939.python-list@python.org>
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=70.196.110.130; posting-account=h3aEwQoAAACiuqX-oR3gvCVFm8lLHoWj
References <kd1667$k6$1@news1.carnet.hr> <mailman.502.1358175849.2939.python-list@python.org>
User-Agent G2/1.0
X-Google-Web-Client true
X-Google-IP 70.196.110.130
MIME-Version 1.0
Subject Re: Python modules
From Rick Johnson <rantingrickjohnson@gmail.com>
To comp.lang.python@googlegroups.com
Content-Type text/plain; charset=ISO-8859-1
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Message-ID <mailman.504.1358180885.2939.python-list@python.org> (permalink)
Lines 16
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1358180885 news.xs4all.nl 6960 [2001:888:2000:d::a6]:40746
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:36798

Show key headers only | View raw


On Monday, January 14, 2013 9:04:00 AM UTC-6, Chris Angelico wrote:
> The performance cost of reimporting a module is very low;
> in fact, trying to avoid it by adorning all your usage
> with an extra dot-level will probably cost you a lot more,
> since there'll be an extra lookup every time.

Most people "adorn" a module with an extra dot to:

    1. create a shorter name (f.e.[1] tk instead of Tkinter)
    
    2. keep their namespace clean. 

Only a fool would do "from Tkinter import *"[2]. A wise programmer, who needed to access many members of Tkinter, would do instead "import Tkinter as tk", and then prepend all members with "tk.".

[1] Abbr: (F)or (E)xample. (I feel an EnglishWart brewing on this subject!)
[2] With the exception of command line testing, learning, or playing.

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


Thread

Python modules zoom <zoom@yahoo.com> - 2013-01-14 15:54 +0100
  Re: Python modules Dan Sommers <dan@tombstonezero.net> - 2013-01-14 15:01 +0000
    Re: Python modules zoom <zoom@yahoo.com> - 2013-01-14 16:03 +0100
  Re: Python modules Chris Angelico <rosuav@gmail.com> - 2013-01-15 02:04 +1100
    Re: Python modules Rick Johnson <rantingrickjohnson@gmail.com> - 2013-01-14 08:27 -0800
    Re: Python modules Rick Johnson <rantingrickjohnson@gmail.com> - 2013-01-14 08:27 -0800
      Re: Python modules Grant Edwards <invalid@invalid.invalid> - 2013-01-14 19:48 +0000

csiph-web