Code density

Peter Hansen peter at engcorp.com
Mon Jun 14 15:23:28 CEST 2004


j_mckitrick wrote:

> When I was reading the PEP for code, Guido suggests using blank lines
> 'sparingly.'  Yet, in most of the 'professional' code(1) I've seen,
> there are often HUGE amounts of whitespace, extra blank lines, and so
> on.  Is this the norm?
> 
> Has python gravitated toward more whitespace in general?

I can't speak for "python", but our informal coding standard
asked for single blank lines between blocks of code that handled
different aspects/steps of a problem, and single lines between
functions/methods, and double blank lines between class or
function definitions at the module level of indentation.

Blank lines are a readability tool as much as clear indentation is.
Depending on the definition of "sparingly", this may be the one
piece of Guido's advice that we've ever ignored... :-)

-Peter



More information about the Python-list mailing list