New submission from Eric Snow <ericsnowcurren...@gmail.com>:

(see #14609 and #14582)

http://docs.python.org/dev/reference/simple_stmts.html#the-import-statement

The specification for the import statement says the following:

"The first form of import statement binds the module name in the local 
namespace to the module object".

This is not the case and has not been the case perhaps ever.  Instead of 
getting bound to the module (returned by loader.load_module() during import), 
the name is bound to the value at sys.modules[module_name].

Normally two approaches yield the same result.  However, if during import the 
sys.modules value for the module is assigned to something else, the behavior 
deviates from the specfication.  See #14609 for an example.

Considering the backwards-compatibility issues, the language reference should 
be updated to reflect the actual behavior.

----------
assignee: docs@python
components: Documentation
messages: 158793
nosy: benjamin.peterson, brett.cannon, docs@python, eric.snow
priority: normal
severity: normal
status: open
title: Clarify import statement documentation regarding what gets bound
versions: Python 2.7, Python 3.2, Python 3.3

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue14628>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to