[Python.NET] DocStringAttribute Example

Tony Roberts tony at pyxll.com
Fri Mar 7 19:19:51 CET 2014


Hi,

if your class has a constructor then the class docstring will get replaced
with a description of the constructor, even if you explicitly gave the
class a docstring using DocStringAttribute.

I've created an issue for github for this and fixed it:
https://github.com/pythonnet/pythonnet/issues/14

In the same commit I added some unit tests which should do as an example
for you to see how it should work (see the newly added file
pythonnet/src/testing/doctest.cs and pythonnet/src/tests/test_docstring.py).

cheers,
Tony



On Wed, Mar 5, 2014 at 3:59 PM, Jonno <jonnojohnson at gmail.com> wrote:

> Hi,
>
> Is there an example how to format documentation in classes & methods so
> that a python docstring will be produced?
>
> I found the following in a thread a while back but it's not working for me:
>
> ### test.cs ##
> using System;
> using System.Runtime.InteropServices;
> using Python.Runtime;
>
> namespace PinvokeTest
> {
> 	[DocStringAttribute("Interface class to external functions.")]
> 	public class Invoke {
> 		
> 		[DocStringAttribute("External funtion simulation: WriteToFile(char)
> will write a char to the terminal.")]
>          	public static void WriteToFile(char arg) {
>              		Console.WriteLine("Writing {0}", arg);
>                          return;
> 		}
> 	}
> }
>
>
> _________________________________________________
> Python.NET mailing list - PythonDotNet at python.org
> https://mail.python.org/mailman/listinfo/pythondotnet
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pythondotnet/attachments/20140307/27e19830/attachment.html>


More information about the PythonDotNet mailing list