A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2010-November/105202.html below:

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

[Python-Dev] On breaking modules into packages Was: [issue10199] Move Demo/turtle under Lib/Raymond Hettinger raymond.hettinger at gmail.com
Wed Nov 3 01:03:00 CET 2010
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  


More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4