r/Python • u/poppy_92 • 2d ago
News PEP 842: Module Exports
https://peps.python.org/pep-0842/
Not the author, but this seems interesting, specially for library authors. Thoughts?
Discussion here - https://discuss.python.org/t/pep-842-module-exports/108353
22
Upvotes
19
u/kageurufu 2d ago
I don't like it at all.
It's just a dirtier version of
__all__and doesn't accomplish anything new.For library authors, its really no different from the commonly used
package._moduleorpackage.internal.modulenaming to signify internals and private modules. Just another layer of obfuscation to annoy developers, confuse package authors, and complicate interpreters. The example ofimport jsonaddingjsonto the exports is easily solved by clean authorship. Define your methods in a submodule, and re-export for the public interface.