This is currently not supported. The compilation of Python into classes/types readily usable by C# or VB is very difficult problem given the dynamic nature of Python and it is one of our open questions to investigate.

 

Martin

 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tom Clancy
Sent: Friday, February 17, 2006 6:20 AM
To: users@lists.ironpython.com
Subject: [IronPython] Consuming Python Classes from C#

 

Sorry if this is an obvious one, but I can't find a good resource on this. I created a very simple Python class library in VS.NET2005 with one file called HelloWorld.py that looks like this:

class Speaker:
    "Just a test to see if I can reference this"
    def __init__(self):
        pass
   
    def speak(self):
        return "Hello, world"

I built it and added it as a reference to a C# project (along with IronPython). I can see a class named "HelloWorld", but cannot instantiate a Speaker object or find a speak method inside the class through the object browser. (I changed the name of the class to make it clearer what VS.NET was seeing)

First off, should my class and filenames match exactly? I've never been clear on that in Python and I feel like it's obscuring my actual problem here. Second, while I see the HelloWorld class in the object browser, whenever I fiddle with the Python code enough to reveal (what should be) a class inside it, it's always static. Why would that be?

But my actual question is: how can I (best) create Python classes and consume them in C#?

Thanks for digging through that ramble,

Tom

_______________________________________________
users mailing list
users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to