Title: Cannot get correct overload of generic method · Issue #821 · pythonnet/pythonnet · GitHub
Open Graph Title: Cannot get correct overload of generic method · Issue #821 · pythonnet/pythonnet
X Title: Cannot get correct overload of generic method · Issue #821 · pythonnet/pythonnet
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 ...
Open Graph 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 multip...
X 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 multip...
Opengraph URL: https://github.com/pythonnet/pythonnet/issues/821
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Cannot get correct overload of generic method","articleBody":"### Environment\r\n\r\n- Pythonnet version: zip archive of master branch\r\n- Python version: 3.6\r\n- Operating System: Ubuntu 18.04\r\n\r\n### Details\r\n\r\n- Describe what you were trying to get done.\r\n\r\nInvoke a generic method with multiple overloads. \r\n\r\n- What commands did you run to trigger this issue?\r\n\r\nOn the C# side I have the following generic method with overloads:\r\n```csharp\r\nVariable\u003cT\u003e Variable.Constant\u003cT\u003e(T)\r\nVariableArray\u003cT\u003e Variable.Constant\u003cT\u003e(T[]) \r\n```\r\nOn the python side, I'm trying to invoke the second overload by doing:\r\n```python\r\na = Variable.Constant(System.Array[System.Double]([1.0, 2.0, 3.0]))\r\n```\r\nBut 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:\r\n```python\r\na = Variable.Constant[System.Double](System.Array[System.Double]([1.0, 2.0, 3.0]))\r\n```\r\nbut then I get the exception:\r\n```python\r\nTypeError: No method matches given arguments for Constant\r\n```\r\nI also tried:\r\n```python\r\na = Variable.Constant.Overloads[System.Double](System.Array[System.Double]([1.0, 2.0, 3.0]))\r\n```\r\nbut then I get the exception:\r\n```python\r\nTypeError: No match found for signature\r\n```\r\nIt 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?","author":{"url":"https://github.com/Tobimaru","@type":"Person","name":"Tobimaru"},"datePublished":"2019-03-02T17:17:23.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":7},"url":"https://github.com/821/pythonnet/issues/821"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:ddec10a0-042c-5bf6-dd46-8b614efb17c4 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 945A:297EC:9FDBE3:E008D0:6970B655 |
| html-safe-nonce | 4dc4be6db0531a2e05d92a052afc44228ee0fabb2f9b6df1a623f896543a953a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NDVBOjI5N0VDOjlGREJFMzpFMDA4RDA6Njk3MEI2NTUiLCJ2aXNpdG9yX2lkIjoiMzk3MDk3MzAyMTAwMTI2Njc3MyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | a8776776d2ffb434f97d613d3ac8a8cd26fd708007b4a897bb93faaf634889d5 |
| hovercard-subject-tag | issue:416418654 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/pythonnet/pythonnet/821/issue_layout |
| twitter:image | https://opengraph.githubassets.com/e8b027cc193d42bc880131a65fb6f01e5adac3b08a163e6533f8cd4877533eb5/pythonnet/pythonnet/issues/821 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/e8b027cc193d42bc880131a65fb6f01e5adac3b08a163e6533f8cd4877533eb5/pythonnet/pythonnet/issues/821 |
| og:image:alt | 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 multip... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Tobimaru |
| hostname | github.com |
| expected-hostname | github.com |
| None | 8e0be80373b724b033cdf8a7b1f78bf5fb6a5d7a2182a9a403aa30894606e390 |
| turbo-cache-control | no-preview |
| go-import | github.com/pythonnet/pythonnet git https://github.com/pythonnet/pythonnet.git |
| octolytics-dimension-user_id | 6050430 |
| octolytics-dimension-user_login | pythonnet |
| octolytics-dimension-repository_id | 14748123 |
| octolytics-dimension-repository_nwo | pythonnet/pythonnet |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 14748123 |
| octolytics-dimension-repository_network_root_nwo | pythonnet/pythonnet |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 84d9d5bf3b01412ea10f7c2429cbfc735ccce9ce |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width