[IronPython] .NET can see Python classes?

Bryan belred at gmail.com
Sun Aug 5 11:05:01 PDT 2007


On 8/5/07, Curt Hagenlocher <curt at hagenlocher.org> wrote:
> On 8/4/07, Darren Govoni <darren at ontrenet.com > wrote:
>
> The fundamental issue here is that Python classes don't follow the same
> semantics as CLR classes.  They are, for instance, mutable after
> construction in ways that CLR classes are not.  In order to expose a Python
> class directly to the CLR, it would have to be "frozen" in some manner, and
> you might prefer to be able to specify the types of the parameters instead
> of dealing with everything as "object".  This would require some sort of
> non-Python syntax to accomplish.  Fortunately, there already is such a
> thing: a CLR interface.  Define an interface in an external assembly and you
> can derive from it in Python.  Your CLR classes can then access the Python
> code through the interface.
>
> --
> Curt Hagenlocher
> curt at hagenlocher.org

hi curt,

i to would like to do this.  i don't understand a part of this.  i
understand creating a CLR interface and i understand creating a python
file that has a class that derives from the CLR interface.  but how
does the CLR code instantiate the derived class and access the Python
code through the interface?  where does this instance come from?

thanks,

bryan


More information about the Users mailing list