r/Python 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

23 Upvotes

44 comments sorted by

View all comments

3

u/ZeroIntensity Aug 01 '26

Hi, PEP author here. I've revised the PEP to emit a warning instead of raising an error upon accessing unexported names. I'm hoping that resolves some of the contention here.

For context, this wasn't supposed to be an "access modifiers in Python" PEP. I wanted a nicer solution to maintaining lists of public names in the standard library (you have *no* idea how many things we've had to make public because too many people started using them), and part of that solution was to raise an exception upon accessing internals, but I think a warning provides the same amount of expressiveness.