[Python-Dev] Tweaking PEP 8 guidelines for use of leading underscores
Terry Reedy
tjreedy at udel.edu
Mon Jul 15 04:10:16 CEST 2013
On 7/14/2013 7:09 AM, Nick Coghlan wrote:
> Slight adjustment to the proposed wording to ensure completely
> undocumented modules are also considered private:
>
> =================
> Private interfaces
>
> Unless explicitly documented otherwise, a leading underscore on any name
> indicates that it is an internal implementation detail and backwards
> compatibility guarantees do not apply. It is strongly encouraged that
> private APIs (whether modules, classes, functions, attributes or other
> names) be clearly marked in this way, as Python users may rely on
> introspection to identify available functionality and may be misled into
> believing an API without a leading underscore is in fact a public API
> with the standard backwards compatibility guarantees.
>
> Even when their names do not start with a leading underscore, all test
> modules and all modules that are not covered in the documentation are
> also considered private interfaces.
I was going to suggest adding 'and most idlelib ' between 'test' and
'modules', but the broader addition covers idlelib, which is not
mentioned yet in the docs, even in the (unindexed) Idle chapter. When it
is, I will try to remember to make explicit which names and interfaces
are public and that the rest are private.
--
Terry Jan Reedy
More information about the Python-Dev
mailing list