
Well done sir! -----Original Message----- From: pythondotnet-bounces+btribble=ea.com@python.org [mailto:pythondotnet-bounces+btribble=ea.com@python.org] On Behalf Of Barton Sent: Saturday, April 23, 2011 4:05 PM To: Brad Byrd Cc: pythondotnet@python.org Subject: Re: [Python.NET] Better doc strings. I just pushed the initial DocStringAttribute mods to the trunk: * Python.Runtime now exposes a public class called DocStringAttribute with usage = AttributeTargets.All * Decorating .NET classes and methods has passed initial tests on Mono. ### 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; } } } ## test.py ## import clr clr.AddReference("SimpleLibTest") # the name of the .NET or Mono assembly import PinvokeTest from PinvokeTest import Invoke # .NET or Mono namespace maps to a python module # so grab the class from there using import Invoke.WriteToFile('a') # Now call a method on the class print "Function docstring:", print Invoke.WriteToFile.__doc__ print "Class docstring:", Invoke.__doc__ i = Invoke() print "Instance docstring:", i.__doc__ On 03/28/2011 10:44 AM, Brad Byrd wrote: I'm trying to provide better documentation for some C# classes that are called from Python. Ideally, I'd like to markup my class in C#, either with the standard XML comments or with something like a [PythonDocAttribute], and have this documentation show up as the __doc__ string for the method or class in Python. That way, the clients of my wrapped objects will see nice tool-tips on my classes as they code away in their IDE. So, is this easily done? Has anyone else crossed this bridge before? Does something already exist that would work before I start hacking on the Python.NET source? (Also, are the archives of the list searchable somewhere? I just saw clickable-by-month archives, not searchable.) Thanks, Brad... _________________________________________________ Python.NET mailing list - PythonDotNet@python.org http://mail.python.org/mailman/listinfo/pythondotnet _________________________________________________ Python.NET mailing list - PythonDotNet@python.org http://mail.python.org/mailman/listinfo/pythondotnet