Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeder2.ecngs.de!ecngs!feeder.ecngs.de!xlned.com!feeder1.xlned.com!newsfeed.xs4all.nl!newsfeed5.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.037 X-Spam-Evidence: '*H*': 0.93; '*S*': 0.00; 'executed': 0.07; 'discriminate': 0.09; 'modules.': 0.09; 'cc:addr:python-list': 0.10; '*can*': 0.16; 'roy': 0.16; 'subject:import': 0.16; 'wrote:': 0.17; 'appears': 0.18; 'module': 0.19; 'import': 0.21; 'cc:2**0': 0.23; 'cc:no real name:2**0': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header :User-Agent:1': 0.26; 'module.': 0.27; 'code': 0.31; 'another': 0.33; 'path': 0.35; 'so,': 0.35; 'bad': 0.37; 'subject:: ': 0.38; 'received:194': 0.61; 'different': 0.63; 'subject:...': 0.63; 'skip:n 10': 0.63; 'smith': 0.71; 'different.': 0.84; 'subject:thought': 0.84; 'careful': 0.91 X-IronPort-AV: E=Sophos;i="4.77,732,1336341600"; d="scan'208";a="640879" X-Virus-Scanned: amavisd-new at zimbra.sequans.com Date: Wed, 08 Aug 2012 10:47:14 +0200 From: Jean-Michel Pichavant User-Agent: Mozilla-Thunderbird 2.0.0.24 (X11/20100328) MIME-Version: 1.0 To: Roy Smith Subject: Re: I thought I understood how import worked... References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 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: 11 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1344415651 news.xs4all.nl 6940 [2001:888:2000:d::a6]:46496 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:26752 Roy Smith wrote: > So, it appears that you *can* import a module twice, if you refer to it by > different names! This is surprising. It means that having non-idempotent code > which is executed at import time is a Bad Thing. > Not exactly, it means that one module is different from another if its path is different. That means you need to be extra careful about how you reference a module. Content is not used to discriminate modules. JM