[Python-Dev] On breaking modules into packages Was: [issue10199] Move Demo/turtle under Lib/

Hrvoje Niksic hrvoje.niksic at avl.com
Wed Nov 3 13:38:58 CET 2010


On 11/03/2010 01:47 AM, Ben Finney wrote:
>>  If someone wants to depend on some undocumented detail of the
>>  directory layout it's their problem (like people depending on bytecode
>>  and other stuff).
>
> I would say that names without a single leading underscore are part of
> the public API, whether documented or not.

I understand this reasoning, but I'd like to offer counter-examples. 
For instance, would you say that glob.glob0 and glob.glob1 are public 
API?  They're undocumented, they're not in __all__, but they don't have 
a leading underscore either, and source comments call them "helper 
functions."  I'm sure there is a lot of other examples like that, both 
in the standard library and in python packages out there.

Other than the existing practice, there is the matter of esthetics. 
Accepting underscore-less identifiers as automatically public leads to a 
proliferation of identifiers with leading underscores, which many people 
(myself included) plainly don't like.


More information about the Python-Dev mailing list