Thanks for the update! Here are a few nits.
-
You fixed the example to raise ExportError instead of issue a warning. But you still state in the next sentence “This is **not** intended to be an access modifier for Python; see the rationale .” Much later you explain what you mean by that – there are legitimate ways to bypass the export controls. But does “access control” really mean to make it physically impossible to access something? That would be hard in Python, as long as we have the
ctypesmodule (or we can load unvetted extensions). Maybe we should simply not use the term “access control” and just state up front what we mean – that there are ways around an ExportError? -
Do we really need to add words to explain that you can’t say
def export name...even though the grammar makes it abundantly clear? -
Maybe we should use an example to explain why reusing
__all__isn’t backwards compatible. -
The explanation of how we went from ImportError to ExportWarning and then back to ExportError should clarify more why we went full circle. Or maybe instead of describing the back-and-forth, explain how issuing a warning is worse due to the inherently poor ergonomics of warnings – warnings occurring in a library punish the user for something they can’t fix, and testing frameworks like pytest turn warnings into errors.
-
I’d shorten the section on
privateto explaining why this is out of scope: it’s a different set of requirements that deserve a separate discussion and another PEP. -
In the section about access to internals from within the same package, consider renaming
_utils.pytoutils.py– the preferred name if we had a proper solution for this. It’s fine that you don’t mention my proposal yet – it reeks expensive, and although a C implementation could be much faster, it would still be a lot more expensive than currently. We might have to benchmark this before accepting it. -
I think another open issue is whether we need a marker near the top of a file indicating that export is being used, and if so, what that marker should look like, and what should happen when the marker is absent but export is used.