So, the situation is I have a C# generic class named Foo
with a template parameter T
which has the new()
constraint. I've declared my classes something like this:
class Baz
{
public Baz() { }
}
class Foo<T>
where T : Baz, new()
{
// blah blah
}
And in Python:
class Bar(Baz):
def __init__(self):
""" do various things here """
However, if, in Python, I try to do Foo[Bar]
, I get an error telling me that my Bar
class violates the constraints (namely the new()
constraint) on Foo<T>
.
What gives?