K
kj
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!
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?
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?
TIA!
~K
P.S. I can think of at least one reason to avoid TQC: it has
basically the same problems with nesting that C's /**/ has. (Sure,
in the case of TQC one could use "the other" triple quote, but it's
not hard to see that this workaround goes only so far.) But this
reason does not seem to bother many programmers, most of whom,
after all, cut their teeth with C and /**/.
P.S.2 I'm disregarding "it's un-Pythonic" as a reason against TQC,
because it's not the kind of reason that carries much weight out
here "in the trenches", as I've discovered. But, yes, I happen to
think that TQC is un-Pythonic. After all, in my programming
environment, it takes half as many keystrokes to comment a block
of code with # than it does with """. I imagine that any decent
programming environment makes #-commenting at least as easy.
Therefore, there goes convenience as an argument in defense of TQC.
Which leaves TMTOWTDI as the only possible defense for TQC, and
TMTOWTDI is pretty un-Pythonic, no?
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!
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?
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?
TIA!
~K
P.S. I can think of at least one reason to avoid TQC: it has
basically the same problems with nesting that C's /**/ has. (Sure,
in the case of TQC one could use "the other" triple quote, but it's
not hard to see that this workaround goes only so far.) But this
reason does not seem to bother many programmers, most of whom,
after all, cut their teeth with C and /**/.
P.S.2 I'm disregarding "it's un-Pythonic" as a reason against TQC,
because it's not the kind of reason that carries much weight out
here "in the trenches", as I've discovered. But, yes, I happen to
think that TQC is un-Pythonic. After all, in my programming
environment, it takes half as many keystrokes to comment a block
of code with # than it does with """. I imagine that any decent
programming environment makes #-commenting at least as easy.
Therefore, there goes convenience as an argument in defense of TQC.
Which leaves TMTOWTDI as the only possible defense for TQC, and
TMTOWTDI is pretty un-Pythonic, no?