PythonCard timer/thread tutorial

Mike Driscoll kyosohma at gmail.com
Thu Dec 25 14:38:17 CET 2008


On Dec 25, 7:24 am, Steven D'Aprano <st... at REMOVE-THIS-
cybersource.com.au> wrote:
> On Wed, 24 Dec 2008 16:59:23 -0800, Mike Driscoll wrote:
> >> Among my questions are:
> >> """ A little thread we've added""" seems to be an isolated string. It
> >> does not seem to be doing anything there, almost like a comment. Why is
> >> it there?
>
> > That's what some people call a doc string.
>
> Other people call it "Maurice". *wink*
>
> A doc[umentation] string is the accepted name for it. Anytime a function,
> class or module starts immediately with a loan string, that string is
> stored by the Python compiler in an attribute __doc__. E.g.:
>
> >>> def parrot(x):
>
> ...     "This is a doc string."
> ...     return "Norwegian Blue"
> ...>>> parrot.__doc__
>
> 'This is a doc string.'
>
> > It is like a comment in that
> > it helps the user know what the function is for. Notice the triple
> > quotes.
>
> Triple quotes are a red herring. Any string literal will do.
>
> --
> Steven

Thanks for clearing that up. I suppose that's more of a recommended
style choice than a requirement. I'm pretty sure some of the Python
books I've read have implied that the triple quotes matter...oh well.
Live and learn. Merry Christmas!

Mike



More information about the Python-list mailing list