
Nick Coghlan wrote:
It's not an unwritten rule, as it already has its own subsection in PEP 8: https://www.python.org/dev/peps/pep-0008/#public-and-internal-interfaces The main question in this thread is what to do about standard library modules that were written before those documented guidelines were put in place, and hence have multiple internal APIs that lack the leading underscore (and I don't think that's a question with a generic answer). Cheers, Nick.
Oh I see, thanks for the clarification. I've read over most of PEP 8 a few times at this point, but somehow I missed this part: "All undocumented interfaces should be assumed to be internal". Apologies for that. Personally, I think the stdlib modules which were written before the rule should be gradually updated, with each one being it's own issue with the respective experts for each of the modules carefully monitoring the changes. It would also be appropriate to provide any user attempting to import a module that is going to be prepended with an underscore with warnings, and at least a couple of versions to update their code.