Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

3
  • 34
    from package import * will still import everything defined in __init__.py, even if there is no all. The important difference is that without __all__ it will not automatically import any modules defined in package's directory. Commented Jul 20, 2014 at 19:37
  • 1
    When all contains [foo, bar] and in test.py file if we use: from package import *, then, do foo and bar get imported in the local namespace of test.py or in the foo and bars own namespace? Commented Oct 12, 2019 at 5:26
  • This answer is incorrect. The referred doc actually intends "module names" to mean names within the module namespace, not names of modules in the package (see github.com/python/cpython/issues/106556). Commented Sep 25, 2023 at 20:30