Q: Python 2.0 preliminary features?
John Farrell
jfarrell at mincom.com
Tue Oct 12 19:05:01 EDT 1999
Phil Hunt wrote:
> Another feature I would like is multi-line comments. Consider a
> paragraph of commented text under the present system; every time
> you want to add a few new lines to the comment you have to
> manually put in `#'s at the start of each new comment line, which I
> find irritating because it breaks the flow of what I am trying to
> explain.
Call me a newbie but what's wrong with inserting a string constant in
the middle of the code?
import dis
def test(x):
x = x * x
"""Now take one off.
We do this by using the subtract operator.
"""
x = x - 1
return x
print test(7)
print dis.dis(test)
If I comment out the string, I get one less byte code which is a
(redundant) SET_LINENO. If the compiler folded sequential SET_LINENOs,
the string would act just like a comment at run-time.
John
More information about the Python-list
mailing list