IronPython Implementation Interface Properties
I am implementing an interface defined in C # in ironPython, but cannot make the real estate implementation work:
FROM#
interface IInterface
{
Dictionary<string, element> Elements { get; }
}
Python:
class Implementor(IInterface):
def __init__(self):
self.elements = Dictionary[str, element]()
def get_Elements(self):
return self.elements
Calling get_Elements throws the following exception:
Expected property for Elements, but Dictionary found [str, element]
What am I doing wrong?
Thank!
+3
source to share
1 answer
With, def Implementor()
you are defining a method, not a class.
Correct code class Implementor()
:
class Implementor(IInterface):
def __init__(self):
self.elements = Dictionary[str, element]()
def get_Elements(self):
return self.elements
this code works fine in my tests (I selected the executor instance variable from python scope in c # and the property works fine).
+1
source to share