Code density
Dave Benjamin
ramen at lackingtalent.com
Sun Jun 13 18:27:08 EDT 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?
Take a look at the modules included with the Python standard library. I
think you'll find that whitespace is used conservatively, but
appropriately. I tend to use more whitespace than most of this code,
however.
I believe Guido likes a blank line after the "class" statement. I tried
this for a little while, but it felt like a special case, like the "one
true brace" policy. On the other hand, I don't like double-linebreaks
anywhere, but this seems to be pretty common with Python code (to
separate function or class definitions). I also tend to line a lot of
things up vertically, which Guido says is one of his pet peeves. =)
> Has python gravitated toward more whitespace in general?
Python ignores whitespace, except where it is significant. As far as
Python programmers ;) I'd say it's a toss-up. I doubt you'll find
consensus here.
Cheers,
Dave
More information about the Python-list
mailing list