Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!news2.euro.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!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; '(of': 0.07; 'initialize': 0.07; '"""': 0.09; 'executed': 0.09; 'from:addr:python': 0.09; 'igor': 0.09; 'namespace': 0.09; 'subject:language': 0.09; 'subject:missing': 0.09; 'subject:reference': 0.09; 'wrote:': 0.14; 'from:addr:mrabarnett.plus.com': 0.16; 'from:name:mrab': 0.16; 'identifier': 0.16; 'message-id:@mrabarnett.plus.com': 0.16; 'namespace.': 0.16; 'necessary;': 0.16; 'occurs).': 0.16; 'received:84.92': 0.16; 'received:84.92.122': 0.16; 'received:84.92.122.60': 0.16; 'repeatedly.': 0.16; 'reply-to:addr :python-list': 0.16; 'subject:skip:d 10': 0.18; 'once,': 0.19; 'modules': 0.20; 'header:In-Reply-To:1': 0.22; '(without': 0.23; 'module,': 0.23; 'received:84': 0.25; 'subject: -- ': 0.25; 'define': 0.26; 'statement': 0.26; 'performs': 0.31; 'are:': 0.31; 'import': 0.32; 'to:addr:python-list': 0.32; 'url:docs': 0.33; 'module': 0.33; "isn't": 0.34; 'header:User-Agent:1': 0.35; 'like:': 0.35; 'reply-to:addr:python.org': 0.35; 'list.': 0.35; 'missing': 0.36; 'two': 0.37; 'url:python': 0.37; 'url:org': 0.38; 'to:addr:python.org': 0.39; 'where': 0.39; 'would': 0.40; 'reply- to:no real name:2**0': 0.72; 'header:Reply-To:1': 0.72; 'enters': 0.73; '"spam"': 0.84; 'subject:think': 0.84; 'subject:found': 0.91 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AhRKAK20uE3Unw4S/2dsb2JhbACXDYFEjS53iGm7eoV2BJJjiRSBBw Date: Thu, 28 Apr 2011 01:29:11 +0100 From: MRAB User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9 MIME-Version: 1.0 To: python-list@python.org Subject: Re: I think I found a mistake in the official language reference documentation -- or I am missing somethig??? References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: python-list@python.org 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: 32 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1303950561 news.xs4all.nl 41114 [::ffff:82.94.164.166]:51116 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:4172 On 27/04/2011 21:02, Igor Soares wrote: > Reading the section "6.11. The import statement" > http://docs.python.org/py3k/reference/simple_stmts.html#the-import-statement > > I found: > """ > Import statements are executed in two steps: (1) find a module, and > initialize it if necessary; (2) define a name or names in the local > namespace (of the scope where the import statement occurs). > (...) > The first form (without from) repeats these steps for each identifier > in the list. The form with from performs step (1) once, and then > performs step (2) repeatedly. > """ > In the last sentence, isn't it the opposite? > With the "from" form it would find/initialize all the modules and > define just the name after "from". > Or am I missing something????? The "from" form is like: from monty import spam, eggs The steps are: 1. find module "monty", and initialize it if necessary 2. define name "spam" in the local namespace 3. define name "eggs" in the local namespace Also note that the name "monty" itself never enters the local namespace.