What's the word on using """ to comment-out?

Lie Ryan lie.1296 at gmail.com
Thu Feb 25 13:50:51 CET 2010


On 02/25/10 05:18, kj wrote:
> I think I remember, early in my learning of Python, coming across
> the commandment "THOU SHALT NOT USE TRIPLE-QUOTES TO COMMENT-OUT
> LINES OF CODE", or something to that effect.  But now I can't find
> it!

I've never heard of it, though I can think of a few reasons why TQC
might be a bad thing. Especially if a user pydoc-ed your module and see
a bunch of meaningless code.

> Is my memory playing me a trick?
> 
> After all, from what I've seen since then, the practice of
> triple-quote-commenting (or TQC, pardon the TCA) is in fact quite
> common.
> 
> Is TQC OK after all?

I'd say it's OK for quick and dirty code, or when you're rewriting a
significant part of the code especially in early development (or you
haven't setup a version control system since it's a damn small script).
They shouldn't be permanent though, due to docstring problem.

> If not, what's the case against it?
> 
> Also, has the BDFL expressed an opinion on the subject?  Alternatively,
> is there any other more or less "authoritative" opinion on TQC? 



More information about the Python-list mailing list