Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Desugar from ... import * statement #4

Open
anandology opened this issue Dec 20, 2012 · 1 comment
Open

Desugar from ... import * statement #4

anandology opened this issue Dec 20, 2012 · 1 comment
Assignees
Labels

Comments

@anandology
Copy link
Contributor

Desugar from foo import * statement.

This requires handling __all__ of the module if present etc.

@ghost ghost assigned lijunsong Dec 20, 2012
@lijunsong
Copy link
Contributor

pick out the IMPL from language reference.

If the list of identifiers is replaced by a star ('*'), all public names defined in the module are bound in the local namespace of the import statement.

The public names defined by a module are determined by checking the module’s namespace for a variable named __all__; if defined, it must be a sequence of strings which are names defined or imported by that module. The names given in __all__ are all considered public and are required to exist. If __all__ is not defined, the set of public names includes all names found in the module’s namespace which do not begin with an underscore character ('_'). __all__ should contain the entire public API. It is intended to avoid accidentally exporting items that are not part of the API (such as library modules which were imported and used within the module).

The from form with * may only occur in a module scope. The wild card form of import — import * — is only allowed at the module level. Attempting to use it in class or function definitions will raise a SyntaxError.

lijunsong added a commit that referenced this issue Dec 23, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants