[New-bugs-announce] [issue27074] Confusing text about __all__ in __init__.py in tutorial

Antti Haapala report at bugs.python.org
Sat May 21 03:45:05 EDT 2016

New submission from Antti Haapala:


says that 

"The import statement uses the following convention: if a package’s __init__.py code defines a list named __all__, it is taken to be the list of module names that should be imported when from package import * is encountered."

However, of course this is not true. The behaviour is that `__all__` lists the names that are to be imported from the package with from package import *; only only those names that raise AttributeError at the time of import would be attempted to be imported as submodules.

assignee: docs at python
components: Documentation
messages: 265990
nosy: docs at python, ztane
priority: normal
severity: normal
status: open
title: Confusing text about __all__ in __init__.py in tutorial
type: enhancement

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list