List to string? Docstrings?
Darrell
news at dorb.com
Mon Sep 13 17:59:17 EDT 1999
>
> 1) For converting a string into a list, I used:
>
> chars = list(text)
>
> For getting back the string from the list, I tried:
>
> import operator
> text = reduce(operator.concat, chars)
>
> but still, I wonder if you would not have a better suggestion...
>
string.join(chars)
> 2) I still miss the purpose of __doc__ strings. It's true that I can
write:
>
> print module.__doc__
> print function.__doc__
>
> and sometimes get useful information from these. But what would I be
> loosing, for my own things, if I was using mere `#' comments instead?
>
They aren't accessable at runtime. People sometimes embed usefull
information into the doc strings. Tim Peters has a testing framework and
John Aycock embed parsing grammer.
http://www.python.org/ftp/python/contrib/All/
doctest.py
http://www.csr.uvic.ca/~aycock/python/
Some doc tools also know to pick up these and avoid the # type of comments.
You don't want all your comments showing up in the doc.
--Darrell
More information about the Python-list
mailing list