[IronPython] Implementing an IronPython extension mechanism with abstract classes

Michael Foord fuzzyman at voidspace.org.uk
Mon Sep 6 19:27:37 CEST 2010


  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 class.)

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


-- 
http://www.ironpythoninaction.com/
http://www.voidspace.org.uk/blog

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.





More information about the Ironpython-users mailing list