[IronPython] Implementing an IronPython extension mechanism with abstract classes
curt at hagenlocher.org
Tue Sep 7 00:02:58 CEST 2010
In order for the virtual methods to be forwarded to Python, the C# class
that's generated by NewTypeMaker has to "bake in" code for all the methods.
You could probably write some Python-based checking code that examines a
Python class C and makes sure that all of the interfaces it derives from and
any abstract functions in its base class have Python implementations.
On Mon, Sep 6, 2010 at 10:27 AM, Michael Foord <fuzzyman at voidspace.org.uk>wrote:
> Hello all,
> A friend was asking some advice about implementing an IronPython extension
> system for a C# application. He wanted to use C# abstract classes so that he
> would get an error attempting to instantiate a plugin class if it didn't
> implement all the required methods. (The extensions subclass his abstract
> He pulled the Python class out of an extension script as a PythonType and
> instantiated it with engine.Operations.Call(PythonClass) - however this
> doesn't throw the exception he expected. (He does get MissingMember
> exceptions trying to call methods that don't exist however.)
> Can this be made to work or is there a better way to do "interface
> checking" of Python classes subclassing .NET types?
> All the best,
> Michael Foord
> READ CAREFULLY. By accepting and reading this email you agree, on behalf of
> your employer, to release me from all obligations and waivers arising from
> any and all NON-NEGOTIATED agreements, licenses, terms-of-service,
> shrinkwrap, clickwrap, browsewrap, confidentiality, non-disclosure,
> non-compete and acceptable use policies (”BOGUS AGREEMENTS”) that I have
> entered into with your employer, its partners, licensors, agents and
> assigns, in perpetuity, without prejudice to my ongoing rights and
> privileges. You further represent that you have the authority to release me
> from any BOGUS AGREEMENTS on behalf of your employer.
> Users mailing list
> Users at lists.ironpython.com
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Ironpython-users