r/Python • u/poppy_92 • Jul 31 '26
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
24
Upvotes
View all comments
Show parent comment
5
u/stevenjd Aug 01 '26 edited Aug 01 '26
Then don't do it. Callers should never treat imports in your module as public variables unless documented as public. Linters should flag the use of
xas as error and let that be the end of it.As an author, I don't get a say in what the caller does or doesn't do with my code, and that is exactly how it should be.
All I can do is say clearly that:
"Consenting adults" applies.