List to string? Docstrings?
Robert Kern
kernr at mail.ncifcrf.gov
Mon Sep 13 17:42:52 EDT 1999
On 13 Sep 1999 17:37:53 -0400, =?ISO-8859-1?Q?Fran=E7ois_Pinard?=
<pinard at iro.umontreal.ca> wrote:
>Hello, people. Still learning Python. I wrote around 6000 Python lines
>in the last 10 days! :-) I have two quick questions for you.
>
>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...
import string
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?
There are a couple tools that will scan your module and generate
documentation from the docstrings. IDLE and a couple other GUI tools
(e.g. PTUI) allow you to browse through a tree representation of your
module and show the docstrings. They are also quite useful in
interactive mode when you don't have have the source conveniently in
front of you.
>--
>François Pinard http://www.iro.umontreal.ca/~pinard
Robert Kern |
----------------------|"In the fields of Hell where the grass grows high
This space | Are the graves of dreams allowed to die."
intentionally | - Richard Harter
left blank. |
More information about the Python-list
mailing list