mirror of https://github.com/python/cpython
wild card import is only allowed at the module level
This commit is contained in:
parent
0468df3d33
commit
9611b5ef75
|
@ -794,10 +794,10 @@ namespace which do not begin with an underscore character (``'_'``).
|
||||||
accidentally exporting items that are not part of the API (such as library
|
accidentally exporting items that are not part of the API (such as library
|
||||||
modules which were imported and used within the module).
|
modules which were imported and used within the module).
|
||||||
|
|
||||||
The :keyword:`from` form with ``*`` may only occur in a module scope. If the
|
The :keyword:`from` form with ``*`` may only occur in a module scope. The wild
|
||||||
wild card form of import --- ``import *`` --- is used in a function and the
|
card form of import --- ``import *`` --- is only allowed at the module level.
|
||||||
function contains or is a nested block with free variables, the compiler will
|
Attempting to use it in class for function definitions will raise a
|
||||||
raise a :exc:`SyntaxError`.
|
:exc:`SyntaxError`.
|
||||||
|
|
||||||
.. index::
|
.. index::
|
||||||
single: relative; import
|
single: relative; import
|
||||||
|
|
Loading…
Reference in New Issue