[IronPython] Using a Python-Module from other Languages over .NET?
dinov at exchange.microsoft.com
Mon Feb 19 19:45:18 PST 2007
In addition to the memory efficiency we get correctness in supporting re-assignment to __class__. All of the types derived from one built-in type share the same in-memory layout. Therefore __class__ can be assigned arbitrarily between them changing the underlying dynamic type - just like CPython.
The one other way to interop would be via interfaces. This has different pros and cons but is worth considering depending on what you're doing.
From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord
Sent: Sunday, February 18, 2007 5:36 AM
To: Discussion of IronPython
Subject: Re: [IronPython] Using a Python-Module from other Languages over .NET?
> i have a litle question: Is it possibel to compile a Python-Module with
> IronPython with all dependencies to a .Net-Module with can used from
> other Languages like VB over .NET?
Not directly I'm afraid.
The .NET garbage collector doesn't collect classes, so for memory
efficiency reasons (? - only ?) IronPython re-uses a single (?) class
That means that IronPython classes can't be consumed directly from other
You can create stub wrapper classes in C# / VB.NET which call into the
engine and use your classes. This is quite simple and somewhere on this
list someone posted an example.
Using the System.Reflection API it should be possible to automate
creating these stub classes. I haven't had time to explore this myself,
but it would be very interesting.
All the best,
> Thx for the answers
> users mailing list
> users at lists.ironpython.com
users mailing list
users at lists.ironpython.com
More information about the users