%feature("docstring") syntax

"Seth G" <[email protected]>
Newsgroups gmane.comp.programming.swig
Message-ID <[email protected]>
Hi all,

A quick question on the syntax for %feature("docstring"). From the docs at http://www.swig.org/Doc4.0/Python.html#Python_nn71

"In addition to the autodoc strings described above, you can also attach any arbitrary descriptive text to a node in the parse tree with the "docstring" feature. "

Most of the SWIG tests use the following syntax:

%feature("docstring")  MyObject::x "float The x value.";

However the simply adding a docstring prior to a function also seems to produce the correct output:

    %feature("docstring")
    "Adjust the rect to fit the width and height. Returns cellsize of rect."
    double fit(int width, int height) {
        return  msAdjustExtent(self, width, height);
    } 

In a search on GitHub I've also seen the following form:

%feature("docstring", "A docstring in the brackets") myFunction

And also sometimes there are semicolons at the end and sometimes not. 

Are all the above examples valid?
I'm happy to expand the docs with a pull request if anyone can provide clarifications.
Thanks,

Seth
 	
	
	

	
In addition to the autodoc strings described above, you can also attach any arbitrary descriptive text to a node in the parse tree with the "docstring" feature. 

--
web:http://geographika.co.uk
twitter: @geographika
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.