Path: csiph.com!usenet.pasdenom.info!dedibox.gegeweb.org!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed6.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.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'true,': 0.04; 'missed': 0.09; 'python': 0.09; '"source': 0.09; 'code"': 0.09; 'imported': 0.09; 'modules.': 0.09; 'references,': 0.09; 'thereof.': 0.09; 'cc:addr:python-list': 0.10; '"module"': 0.16; 'confusion': 0.16; 'distinct': 0.16; 'finney': 0.16; 'from:addr:cs': 0.16; 'from:addr:zip.com.au': 0.16; 'from:name:cameron simpson': 0.16; 'in-memory': 0.16; 'message-id:@cskk.homeip.net': 0.16; 'modules,': 0.16; 'nail': 0.16; 'received:202.125.174': 0.16; 'received:202.125.174.133': 0.16; 'received:boardofstudies.nsw.edu.au': 0.16; 'received:cskk.homeip.net': 0.16; 'received:edu.au': 0.16; 'received:harvey.boardofstudies.nsw.edu.au': 0.16; 'received:homeip.net': 0.16; 'received:nsw.edu.au': 0.16; 'simpson': 0.16; 'subject:import': 0.16; 'thought.': 0.16; 'variations': 0.16; 'wrote:': 0.17; 'byte': 0.17; 'module,': 0.17; 'saying': 0.18; 'code,': 0.18; 'module': 0.19; 'code.': 0.20; 'names.': 0.22; 'cheers,': 0.23; 'cc:2**0': 0.23; 'example': 0.23; 'seems': 0.23; 'cc:no real name:2**0': 0.24; 'allows': 0.25; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header :User-Agent:1': 0.26; '(such': 0.27; 'first.': 0.27; 'implies': 0.29; 'writes:': 0.29; 'source': 0.29; 'relative': 0.30; 'expect': 0.31; 'code': 0.31; 'point': 0.31; 'file': 0.32; 'loading': 0.33; 'ben': 0.35; 'described': 0.35; 'something': 0.35; 'but': 0.36; 'loaded': 0.36; 'modules': 0.36; 'received:au': 0.36; "didn't": 0.36; 'available.': 0.37; 'bad': 0.37; 'two': 0.37; 'why': 0.37; 'subject:: ': 0.38; 'object': 0.38; 'things': 0.38; 'end': 0.40; 'content-disposition:inline': 0.60; 'referred': 0.62; 'different': 0.63; 'subject:...': 0.63; 'details': 0.63; 'obtained': 0.71; 'confusion.': 0.84; 'subject:thought': 0.84 Date: Thu, 9 Aug 2012 15:52:22 +1000 From: Cameron Simpson To: Ben Finney Subject: Re: I thought I understood how import worked... MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <87hasehvfu.fsf@benfinney.id.au> User-Agent: Mutt/1.5.21 (2010-09-15) References: <87hasehvfu.fsf@benfinney.id.au> 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: 43 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1344491553 news.xs4all.nl 6846 [2001:888:2000:d::a6]:53611 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:26779 On 08Aug2012 14:14, Ben Finney wrote: | Cameron Simpson writes: | > All of you are saying "two names for the same module", and variations | > thereof. And that is why the doco confuses. | > | > I would expect less confusion if the above example were described as | > _two_ modules, with the same source code. | | That's not true though, is it? It's the same module object with two | different references, I thought. No. They're two in-memory module instantiations with distinct module names. ISTR that when this got me I had imported the a module in one place with its full name and elsewhere with a bad relative reference; I forget the details now. But anyway, that got me the same module code loaded twice, distinctly named. | Also, even if what you say were true, “source code” implies the module | was loaded from source code, when Python allows loading modules with no | source code available. So that implication just seems to be inviting | different confusion. Please let's nail one thing first. We can always quibble about the term "source code" to prefer "source code or byte code" or something of that ilki, later. But the confusion comes from calling these things the "same module". Which breaks the "modules are only loaded once" mental image. The confusion would often be avoided if the doco took the line that it is two modules because they were obtained using two names. Their original might be the same physical/logical place (such as a module source code file), but the end result is two modules. The point is that the "module" term would be better if it referred to the in-memory Python module, and didn't do double time as meaning the (typically) source file from which the Python code comes. Cheers, -- Cameron Simpson We had the experience, but missed the meaning. - T.S. Eliot