I think I found a mistake in the official language reference documentation -- or I am missing somethig???
kwatford+python at gmail.com
Wed Apr 27 23:21:13 CEST 2011
On Wed, Apr 27, 2011 at 4:02 PM, Igor Soares <ibp.srs at gmail.com> wrote:
> Reading the section "6.11. 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?????
Judging only by what you've quoted, the forms would be:
1) import os, sys, glob
2) from os.path import exists, split, join
In the first form, one or more modules come after the 'import'. In the
second form, a single module comes after the 'from', and then multiple
names from within that module come after the 'import'. Looks fine to
More information about the Python-list