[Python-ideas] Was `os.errno` undocumented?

INADA Naoki songofacandy at gmail.com
Tue May 29 08:42:10 EDT 2018


> I agree that it's technically well within our rights to remove it
> without notice.
> But ... PEP8? A style guide defines what is a CPython implementation
> detail? That's not a place to point to while saying "told you so!" --
> perhaps "sorry for the inconvenience" would be more appropriate :)


https://www.python.org/dev/peps/pep-0008/#public-and-internal-interfaces

"Any backwards compatibility guarantees apply only to public interfaces."

"All undocumented interfaces should be assumed to be internal."

"Imported names should always be considered an implementation detail. Other
modules must not rely on indirect access to such imported names unless they
are an explicitly documented part of the containing module's API, such as
os.path or a package's __init__ module that exposes functionality from
submodules."



> > And maybe this will encourage linters to flag this risky usage, if they
> > aren't already doing so.

> How do linters find out what's an internal import, and what's correct
> usage (like os.path)?


It is `correct usage` only when it is in __all__.

   >>> "path" in os.__all__
   True
   >>> "errno" in os.__all__
   False


Regards,

-- 
INADA Naoki  <songofacandy at gmail.com>


More information about the Python-ideas mailing list