Christian Tanzer wrote: > > > > > >>> class C: > > > > ... "first line"\ > > > > ... "second line" > > > > ... > > > > >>> C.__doc__ > > > > 'first linesecond line' > > > > > > > > And the same works for the attribute doc strings too. > > > > > > Surprise. I tried it this morning. Didn't use a backslash, though. And almost > > > overlooked it now. > > > > You could also wrap the doc string in parenthesis or use a triple > > quote string. > > Wrapping a docstring in parentheses doesn't work in 1.5.2: > > Python 1.5.2 (#5, Jan 4 2000, 11:37:02) [GCC 2.7.2.1] on linux2 > Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam > >>> class C: > ... ("first line" > ... "second line") > ... > >>> C.__doc__ > >>> Hmm, looks like you're right... the parenthesis probably only work for "if" and function calls. This works: function("firstline" "secondline") > Triple quoted strings work -- that's what I'm constantly using. The > downside is, that the docstrings either contain spurious white space > or it messes up the layout of the code (if you start subsequent lines > in the first column). Just a question of how smart you doc string extraction tools are. Have a look at hack.py: http://starship.python.net/~lemburg/hack.py and its docs() API: >>> class C: ... """ first line ... second line ... third line ... """ ... >>> import hack >>> hack.docs(C) Class : first line second line third line -- Marc-Andre Lemburg ______________________________________________________________________ Business: http://www.lemburg.com/ Python Pages: http://www.lemburg.com/python/
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4