On Nov 10, 2010, at 8:47 AM, Michael Foord wrote:
> How about making this explicit (either pep 8 or our developer docs):
> 
> If a module or package defines __all__ that authoritatively defines the 
> public interface. Modules with __all__ SHOULD still respect the naming 
> conventions (leading underscore for private members) to avoid confusing 
> users. Modules SHOULD NOT export private members in __all__.

I don't like the idea of the authoritative definition of a public interface 
being defined based on __all__, because that provides users almost no warning 
that they're using a private API: the __all__ attribute doesn't do anything if 
you aren't using import *. If there was some proposal to make it so that 
accessing an attribute not in __all__ did prevent or somehow warn users that 
they're doing something dangerous, that'd be different, but there isn't such a 
proposal, and I don't even know what such a proposal would look like...

On the other hand, if you make the primary mechanism to indicate privateness be 
a leading underscore, that's obvious to everyone.

James
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to