About reading Python code

Phil cabalamat at googlemail.com
Tue Mar 25 10:23:57 EDT 2008


On 2008-03-18, sturlamolden <sturlamolden at yahoo.no> wrote:
> First, I recommend that you write readable code! Don't use Python as
> if you're entering the obfuscated C contest.
>
> Two particularly important points:
>
> * Comments are always helpful to the reader.

It would be nice if this was the case! I once saw a preogram where 
a line of code like this:

   foo++;

Would be annotated with a comment like this:

   /****************************************************/
   /*                                                  */
   /* Increment foo                                    */
   /*                                                  */
   /****************************************************/

This comment was worse than useless, because it (and others like 
it) took up space that distracted from the information-containing 
parts of the code.




More information about the Python-list mailing list