On Nov 2, 2010, at 4:43 PM, Guido van Rossum wrote:

>  The remaining thrust of the thread seems
> to be whether PEP 8 should advise against breaking code up into many
> little modules.

I was thinking of PEP 8 wording that listed the forces for and against.

For example, ply.yacc and ply.lex was a very useful split (separately testable, 
natural division of concerns, no nested of cross-imports).

The xml.sax, xml.dom, and xml.minidom was a nice split because it separated 
distinct tools.  The xml packaging also worked well because it is easy to 
substitute in alternate parsers implementing the same API.

I think we also want to recommend against putting much if any code in 
__init__.py.

Some forces against packaging are that it breaks the class browser.  As you 
say, different users of different toolsets are affected differently.  For me, 
the unittest split broke my usual ways of finding out how the new methods were 
implemented.

Another force against is what Brett pointed-out, that the package file 
structure becomes a permanent and unchangeable part of the API.  It's a one-way 
street.

In general, I think the advice should be that packaging should be done when 
there is some clear benefit beyond "turning one big file into lots of smaller 
files". 


Raymond  


_______________________________________________
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