I think this is a step in the right direction, but it still doesn’t solve all of the problems with the current exporting behavior.
In particular, many libraries try to control not only what gets exported, but what gets hidden. And they do that by moving all of their source files to private folder (e.g., _src
) and then building a directory tree for just their exports with files named __init__.py
. These files only contain from... import
statements and __all__
lists.
This proposal merges the __all__
lists into the import statements, which is definitely a step in the right direction. However, there is still the hassle of creating a parallel structure just so that you can have a clean library interface. In my opinion, if we’re goin to add keywords, it would be nice to resolve all of the problems with exporting.
Just off the top of my head, how about creating __export__.py
files whose attributes are the only thing that gets exported from a given directory?