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: 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: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=70.196.110.130; posting-account=h3aEwQoAAACiuqX-oR3gvCVFm8lLHoWj References: 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 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Message-ID: 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 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.