-
Notifications
You must be signed in to change notification settings - Fork 768
Description
Environment
- Pythonnet version: zip archive of master branch
- Python version: 3.6
- Operating System: Ubuntu 18.04
Details
- Describe what you were trying to get done.
Invoke a generic method with multiple overloads.
- What commands did you run to trigger this issue?
On the C# side I have the following generic method with overloads:
Variable<T> Variable.Constant<T>(T)
VariableArray<T> Variable.Constant<T>(T[]) On the python side, I'm trying to invoke the second overload by doing:
a = Variable.Constant(System.Array[System.Double]([1.0, 2.0, 3.0]))But when I check the type of a, it gives Variable[System.Double[]] and not VariableArray[System.Double]. This makes sense since it's ambiguous without specifying the type of the output variable or specifying the type for the function. Since in python I can't pin the output variable to a specific type, I tried to resolve the ambiguity with:
a = Variable.Constant[System.Double](System.Array[System.Double]([1.0, 2.0, 3.0]))but then I get the exception:
TypeError: No method matches given arguments for ConstantI also tried:
a = Variable.Constant.Overloads[System.Double](System.Array[System.Double]([1.0, 2.0, 3.0]))but then I get the exception:
TypeError: No match found for signatureIt seems that there is pull-request (#227) ongoing, but it looks to have been work in progress for quite a while now. Is this is not priority, is there a workaround that I can try?