[Python.NET] how to implement Implements in py4.net

J. Merrill jvm_cop at spamcop.net
Mon Apr 11 04:41:39 CEST 2005


I think you're looking at the wrong Python.  Python.Net lets write Python code that lets you get your hands on code implemented using .Net.  It does not let you write .Net code.

Virtually anything that needs to implement a .Net interface (like your company.program.IExternalComm example) needs to be written in a .Net language.  (The only alternative would be if the interface could be written using COM, but that would be unusual unless special arrangements are made.)

It seems a shame to me that AFAIK no one has built a .Net mechanism that lets one easily embed a copy of CPython 2.x and use it as a scripting language.  That would let you replace the "hello world" with something to call your existing Python code, which I presume is what you really want to be doing.

IronPython might let you do the equivalent, running your existing Python code from a .Net language, depending on whether your existing Python code would work in IronPython.

At 10:17 PM 4/8/2005, Guy Robinson wrote:
>Hello,
>
>I have an example VB.NET script (see below) that I'm trying to recreate using python for .NET.
>
>How do I implement the Implements function?
>
>Any help appreciated.
>Regards,
>
>Guy
>
>"""
>Public Class Command
>
>   Implements company.program.IExternalComm
>
>   Public Function Execute(ByVal application As company.program.Application, ByRef mesge As String, ByVal ds As company.program.dataSet) As company.program.IExternalComm.Result Implements company.program.IExternalComm.Execute
>
>      MsgBox("Hello World")
>
>      Return company.program.IExternalComm.Result.Succeeded
>
>   End Function
>
>End Class
>"""


J. Merrill / Analytical Software Corp



More information about the PythonDotNet mailing list