Re: [Python-Dev] docstring before function declaration

2005-03-23 Thread Anthony Baxter
On Tuesday 22 March 2005 05:58, Nicholas Jacobson wrote: > Oops, you're right. > > What I should have said is to use a blank docstring as > follows: It's still unclear to me what a file containing a single docstring followed by a def() line means. And this ambiguity doesn't seem to be solvable, so

Re: [Python-Dev] docstring before function declaration

2005-03-23 Thread Nicholas Jacobson
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 <[EMAIL PROTECTED]> wrote: > On Monday 21 March 2005 20:08, Nicholas Jacobson > wrote: >

Re: [Python-Dev] docstring before function declaration

2005-03-22 Thread Nicholas Jacobson
Oops, you're right. What I should have said is to use an empty docstring as follows: "" """Function docstring.""" def foo: ... or: """Module docstring.""" "" def foo: ... So the first docstring is the module docstring, and the next is the first class/function. And again, if th

Re: [Python-Dev] docstring before function declaration

2005-03-21 Thread Greg Ewing
Nicholas Jacobson wrote: 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. -1 on all this making of blank lines significa

Re: [Python-Dev] docstring before function declaration

2005-03-21 Thread Brett C.
Nicholas Jacobson wrote: IIRC, Guido once mentioned that he regretted not setting function docstrings to come before the function declaration line, instead of after. He did, but I don't know how strong that regret is. i.e. """This describes class Bar.""" class Bar: ... Or with a decorator: """This

Re: [Python-Dev] docstring before function declaration

2005-03-21 Thread Anthony Baxter
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 > t

Re: [Python-Dev] docstring before function declaration

2005-03-21 Thread Nicholas Jacobson
Rule #1: If the docstring is the first line of a module, it's the module's docstring. Rule #2: If the docstring comes right before a class/function, it's that class/function's docstring. > How do you distinguish between a docstring at the > top of a module > that's immediately followed by a fun

Re: [Python-Dev] docstring before function declaration

2005-03-20 Thread Anthony Baxter
On Monday 21 March 2005 18:10, Nicholas Jacobson wrote: > IIRC, Guido once mentioned that he regretted not > setting function docstrings to come before the > function declaration line, instead of after. How do you distinguish between a docstring at the top of a module that's immediately followed