triple quoted strings as comments

Magnus Lycka lycka at carmen.se
Wed Feb 1 02:52:22 EST 2006


dmh2000 wrote:
> I recently complained elsewhere that Python doesn't have multiline
> comments. 
It seems you have a bad editor if it can't conveniently
add and remove comment markers for arbitrary blocks in
your source. (Maybe you just didn't find this feature.)

That every comment line begins with a special symbol just
adds clarity. It's a bonus.  C++ introduced // as comment
symbol for this purpose (but was stuck with /* and */ due
to backward compatibility reasons).  Ada, while otherwise
similar to Pascal, adopted -- to end of row instead of (*
and *) etc.

An editor that adds/removes '# ' in the beginning of each
marked line is fairly bullet proof. Adding e.g. /* to the
beginning of a block you want to comment out, & */ to the
end, breaks if you have /* */ style comments in the block!



More information about the Python-list mailing list