wish: multiline comments
Fred L. Drake, Jr.
fdrake at acm.org
Wed Dec 1 10:44:31 EST 1999
Adrian Eyre writes:
> I would like to see multiline comments possible in some future
> version of Python.
Someone suggested:
> Use multiline strings.
Adrian responded:
> Not quite the same is it? A docstring will be put in the .pyc. A comment
> won't.
Only docstrings will be added to the .pyc, not *every* multiline
string.
class B:
"""Okay. This is a short, 1-line docstring."""
"""This is my 42-million line extended comment. Pretend I
really wrote a lot here.
"""
pass
> In one case, the .pyc generated is much bigger than the other. I not saying
> that docstrings are bad, but they are NOT the same as comments, in that they
> serve a purpose at runtime.
Using multiple long strings allows for both a runtime-accessible
docstring, extensive documentation, and minimal .pyc size and runtime
memory consumption. Tools that are being prototyped and discussed in
the Doc-SIG will be able to make use of multiple long docstring-like
strings, so this also provides some forward-compatibility.
-Fred
--
Fred L. Drake, Jr. <fdrake at acm.org>
Corporation for National Research Initiatives
More information about the Python-list
mailing list