[ubuntu-us-in] Time for a change

Simón Ruiz simon.a.ruiz at gmail.com
Tue Nov 20 03:49:19 GMT 2007


Yes, please...and this is to all of you who write, or will ever write
any sort of code.

One day, someone may have to debug your code, so for Love's sake, COMMENT IT.

At least explain your basic logic, what each "chunk" of your code is
for, what to expect from functions, etc.

Uncommented code is a pain to wade through...

On the other extreme, there's no need to comment like this:

# Ask the user whether the want to play a nice game of Chess.
playChess = raw_input('Do you want to play a nice game of Chess?')
# If they don't say no
if playChess != 'n' and playChess !=  'N':
    # Play Chess
    Chess.play()

If you catch my drift. This will just train people (including
yourself) to ignore your comments.

Simón

On Nov 19, 2007 10:21 PM, Rob Ludwick <rob at rcludw.no-ip.org> wrote:
> Python... it's easy to program in.  Too easy.  Debugging other's code
> can be a challenge because type and function obfuscation is part of the
> language, and programmers don't always document their code clearly.



More information about the Ubuntu-us-in mailing list