Code density

grv grv575 at hotmail.com
Wed Aug 4 03:53:47 CEST 2004


michele.simionato at poste.it (Michele Simionato) wrote in
<95aa1afa.0406172240.651a443d at posting.google.com>: 

>j_mckitrick at bigfoot.com (j_mckitrick) wrote in message
>news:<ec6dce8b.0406171655.2e7c4713 at posting.google.com>... 
>> Peter Hansen <peter at engcorp.com> wrote in message > 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... :-)
>> 
>> I've found myself using even more blank lines in python than C++.  But
>> if you look at BitTorrent, for example, the author claims blank lines
>> are a nuisance.  He writes very dense code, but I wonder if it would
>> be easily maintainable by anyone besides him.
>> 
>> 
>> jonathon
>
>He also does not use docstrings. I think BitTorrent code is not
>typical
>in this respect. Look at the code in the standard library if you want
>to see how the core Python developer write. Reading the modules
>written by Tim Peters
>is especially entertaining (lots of <winks> and LOL remarks ;)
>I also would take them as examples when teaching clarity in coding.
>
>
>               Michele Simionato
>

Depends on your style really.  A comment to the right of the piece of code 
or above it if it's describing more than 1 step, serves the same purpose as 
breaking atomic groups of code with whitespace.  Plus then you have a 
concise comment which can be read much faster than figuring out 4-5 lines 
of python mentally.



More information about the Python-list mailing list