Title: How to pass *varargs? · Issue #1771 · pythonnet/pythonnet · GitHub
Open Graph Title: How to pass *varargs? · Issue #1771 · pythonnet/pythonnet
X Title: How to pass *varargs? · Issue #1771 · pythonnet/pythonnet
Description: How do you pass a variable list of arguments in pythonnet? The problem is the function numpy.gradient(f, *varargs, axis=None, edge_order=1) as documented here: https://numpy.org/doc/stable/reference/generated/numpy.gradient.html Here is ...
Open Graph Description: How do you pass a variable list of arguments in pythonnet? The problem is the function numpy.gradient(f, *varargs, axis=None, edge_order=1) as documented here: https://numpy.org/doc/stable/referenc...
X Description: How do you pass a variable list of arguments in pythonnet? The problem is the function numpy.gradient(f, *varargs, axis=None, edge_order=1) as documented here: https://numpy.org/doc/stable/referenc...
Opengraph URL: https://github.com/pythonnet/pythonnet/issues/1771
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"How to pass *varargs?","articleBody":"How do you pass a variable list of arguments in pythonnet? The problem is the function `numpy.gradient(f, *varargs, axis=None, edge_order=1)` as documented here: https://numpy.org/doc/stable/reference/generated/numpy.gradient.html\r\n\r\nHere is an example in python\r\n\r\n```python\r\n\u003e\u003e\u003e import numpy as np\r\n\u003e\u003e\u003e dx=4.0\r\n\u003e\u003e\u003e dy=5.0\r\n\u003e\u003e\u003e zX=[[1,2,3],[4,5,6],[8,9,0]]\r\n\u003e\u003e\u003e np.gradient(zX, dx, dy)\r\n[array([[ 0.75 , 0.75 , 0.75 ],\r\n [ 0.875, 0.875, -0.375],\r\n [ 1. , 1. , -1.5 ]]), array([[ 0.2, 0.2, 0.2],\r\n [ 0.2, 0.2, 0.2],\r\n [ 0.2, -0.8, -1.8]])]\r\n\u003e\u003e\u003e\r\n```\r\n\r\nI tried to pass the variable args with the args tuple but then the python function complains that the number of arguments is incorrect. \r\n\r\n```text\r\nPython.Runtime.PythonException: TypeError : invalid number of arguments\r\n [' File \"C:\\\\Users\\\\henon\\\\AppData\\\\Local\\\\python-3.7.3-embed-amd64\\\\lib\\\\numpy\\\\lib\\\\function_base.py\", line 1013, in gradient\\n raise TypeError(\"invalid number of arguments\")\\n'] at Python.Runtime.PyObject.Invoke(PyTuple args, PyDict kw)\r\n at Python.Runtime.PyObject.InvokeMethod(String name, PyTuple args, PyDict kw)\r\n```\r\n\r\nI also tried to pass it as kw[\"varargs\"] but then python says there is no kwarg named \"varargs\"\r\n\r\nSo how to call that function? ","author":{"url":"https://github.com/henon","@type":"Person","name":"henon"},"datePublished":"2022-04-24T20:54:00.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/1771/pythonnet/issues/1771"}
| 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:677a143a-304b-1bc1-5d84-6e8cf6f62a7a |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CE64:1462F2:AF7C1C:F738EF:697255E3 |
| html-safe-nonce | f40c6dc2272c279f9d0d6bd46fddf8a158f387bf6f06d7fce4c5d7e9a34265de |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDRTY0OjE0NjJGMjpBRjdDMUM6RjczOEVGOjY5NzI1NUUzIiwidmlzaXRvcl9pZCI6IjY4MjE1NTU5NDUwNzE1OTcwMjciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | ef258c0704172ea6abf3dad5e8e301285b811c3e822cf9fb5420d9ea415ee411 |
| hovercard-subject-tag | issue:1213765984 |
| 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/1771/issue_layout |
| twitter:image | https://opengraph.githubassets.com/4048eac5058ab659988f656fb6b2c1ab6ad9f291d2fc5a485c1538d6928453d0/pythonnet/pythonnet/issues/1771 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/4048eac5058ab659988f656fb6b2c1ab6ad9f291d2fc5a485c1538d6928453d0/pythonnet/pythonnet/issues/1771 |
| og:image:alt | How do you pass a variable list of arguments in pythonnet? The problem is the function numpy.gradient(f, *varargs, axis=None, edge_order=1) as documented here: https://numpy.org/doc/stable/referenc... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | henon |
| hostname | github.com |
| expected-hostname | github.com |
| None | f6d9b08324bb62b2cf170b9e435da2bdc7efa5aa93e7ca70ee3162552c05329b |
| 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 | 169d2b5c72bff9cc676084f0ac7f8ea888f15f54 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width