On 06/09/2010 23:02, Curt Hagenlocher wrote:
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.
Thanks Curt. I suspected it was something like that.
All the best,
Michael
On Mon, Sep 6, 2010 at 10:27 AM, Michael Foord
<fuzzy...@voidspace.org.uk <mailto:fuzzy...@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 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.
_______________________________________________
Users mailing list
Users@lists.ironpython.com <mailto:Users@lists.ironpython.com>
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
_______________________________________________
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
--
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.
_______________________________________________
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com