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

Michael Foord fuzzyman at voidspace.org.uk
Tue Oct 26 22:46:15 CEST 2010

On 26/10/2010 15:05, R. David Murray wrote:
> On Tue, 26 Oct 2010 10:39:19 -0700, Raymond Hettinger<raymond.hettinger at gmail.com>  wrote:
>> If someone wants to reorganize code for clarity, I would prefer keeping
>> it within one file, bringing related functions together and using
>> comment lines to mark the major sections.  ISTM, this is cleaner than
>> introducing a new directory and having multiple files that cross-import
>> one another.
> +1 (or more)
Really, you prefer to work in single multi-thousand line modules than 
cleanly split smaller packages? (Is that how you develop your own 
projects, out of interest?)

The cross imports are unfortunate (there are very few actually circular 
dependencies in the package though I think), but more of an indictment 
on the design of unittest than the decision to split it into a package.

How the splitting happened is that I proposed it on this list many 
months ago and got one reply in favour and no dissenters. Benjamin 
actually did the splitting.

I find unittest *massively* easier to maintain and navigate now that it 
is a package. It doesn't take very long to work out where the classes 
live (no time at all if you look in the module names - where the classes 
live is *very* obvious except for the TextTestResult which lives 
alongside the TestRunner). The package split into modules is into 
conceptual units, where the responsibility of the units is clear. This 
makes the code not only easier to navigate but easier to *think about*. 
The structure of unittest is now much clearer.

I find the big-ball-of-mud style development, where everything lives 
inside huge monolithic modules, very painful. I also think that it is an 
extremely bad example for new developers. There is something to be said 
for consistency within the standard library, but I don't think it is a 
price worth paying in this particular case.

All the best,

Michael Foord

> --
> R. David Murray                                      www.bitdance.com
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: http://mail.python.org/mailman/options/python-dev/fuzzyman%40voidspace.org.uk


More information about the Python-Dev mailing list