fenics team mailing list archive
-
fenics team
-
Mailing list archive
-
Message #01044
Re: FEniCS Documentation -- PyDOLFIN doc-strings
[snip]
> > How would you do that? I tried
> >
> > %extend dolfin::GenericVector
> > {
> > %pythoncode
> > %{
> > def data(self):
> > generated_docstring_module.GenericVector.data.__doc__
> > return self._data()
> > %}
> > }
> >
> > But it was only possible to have a "real" string, not a variable that was
> > a str. Not sure why...
>
> Me neither, what I thought about doing was to generate the contents of
> the *_post.i files from some source and then insert the docstring as a
> literal string in the *_post.i file. But I decided that was too much
> work.
>
> So what I will end up doing is to assign to the __doc__ members of
> these functions in the dolfin/__init__.py (on import). This is
> possible because Swig doesn't mess around with these functions but
> just adds them to the module. If the *_post.i contains other than
> simple functions/member functions we'll have to generate the *_post.i
> files from some source.
Would this work? I tried:
class A(object):
def jada(self):pass
A.jada.__doc__ = "jada"
but I got
attribute '__doc__' of 'instancemethod' objects is not writable
I am still on vacation, which mean that I have been away from coding a bit so
my Python is a bit rusty ;)
Johan
Follow ups
References