c# - Implement nested interface of generic parent class with ironpython -
i wan't implement following c#/.net interface ironpython:
public static class consumes<tmessage> tmessage : class { public interface { void consume(tmessage message); } } this python code tried far:
class testmessage(object): pass class testconsumer(consumes[testmessage].all): def consume(self, message): pass from following exception:
typeerror: testconsumer: cannot inhert open generic instantiation masstransit.consumes`1+all[tmessage]. closed instantiations supported.
a valid c# class definition implement interface looks following:
public class testconsumer : consumes<testmessage>.all { public void consume(testmessage msg) { } } so not possible implement kind of in ironpython? or doing wrong?
thank in advance!
it looks implementing nested interface as
class testconsumer(consumes[testmessage].all): does not correctly bind type parameter tmessage though expected syntax. if type provided @ end ("for interface instead of surrounding class") seems work expected:
class testconsumer(consumes.all[testmessage]): what work importing interface all explicitly , use looking standalone generic interface:
from mylib.consumes import class testconsumer(all[testmessage]): it not seem obvious if behavior correct/defined way or if there bug in type generation (besides "inhert"-typo) or in way generic parameters defined/bound. looks accepted bind parameter twice:
class pytestconsumer(consumes[string].all[string]): even different values not make sense looking @ .net perspective:
class pytestconsumer(consumes[list[string]].all[string]):
Comments
Post a Comment