Oops, you're right. What I should have said is to use a blank docstring as follows: """""" """Function docstring.""" def foo: ... or: """Module docstring.""" """""" def foo: ... --- Anthony Baxter <anthony at interlink.com.au> wrote: > On Monday 21 March 2005 20:08, Nicholas Jacobson > wrote: > > > How do you distinguish between a docstring at > the > > > top of a module > > > that's immediately followed by a function? Is > it > > > the module docstring > > > or the function docstring? > > > > It's both. The docstring would be assigned to > both > > the module and the function. This is a *good* > thing > > when there is a module with only one function in > it. > > i.e. there should only be one docstring for both, > and > > this saves repetition of that docstring. > > > > If a programmer wanted a docstring for the > function > > but not the module, a blank first line would do > the > > trick. A docstring for the module but not the > > function? Put a blank line between the module's > > docstring and the function. > > Yuk. This is magic taken to a ridiculous level. Note > that > "blank lines" currently have no meaning in Python, > and adding > a meaning to them is not my idea of a good thing. > > -- > Anthony Baxter <anthony at interlink.com.au> > It's never too late to have a happy childhood. > __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
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