Title: Cleaning up variable argument signatures · Issue #9912 · matplotlib/matplotlib · GitHub
Open Graph Title: Cleaning up variable argument signatures · Issue #9912 · matplotlib/matplotlib
X Title: Cleaning up variable argument signatures · Issue #9912 · matplotlib/matplotlib
Description: There are a lot of *args, **kwargs signatures in the API. In many cases, they could be better described by explicit arguments/kw-arguments. This makes for a more clear API and reduces the chance of unintended misuse. For example pyplot.d...
Open Graph Description: There are a lot of *args, **kwargs signatures in the API. In many cases, they could be better described by explicit arguments/kw-arguments. This makes for a more clear API and reduces the chance of...
X Description: There are a lot of *args, **kwargs signatures in the API. In many cases, they could be better described by explicit arguments/kw-arguments. This makes for a more clear API and reduces the chance of...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/9912
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Cleaning up variable argument signatures","articleBody":"There are a lot of `*args, **kwargs` signatures in the API. In many cases, they could be better described by explicit arguments/kw-arguments. This makes for a more clear API and reduces the chance of unintended misuse.\r\n\r\nFor example [pyplot.delaxes](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.delaxes.html#matplotlib.pyplot.delaxes)\r\n~~~\r\ndef delaxes(*args):\r\n \"\"\"...\"\"\"\r\n if not len(args):\r\n ax = gca()\r\n else:\r\n ax = args[0]\r\n ...\r\n~~~\r\n\r\nwould be more clear with\r\n\r\n~~~\r\ndef delaxes(ax=None):\r\n \"\"\"...\"\"\"\r\n if ax is None:\r\n ax = gca()\r\n ...\r\n~~~\r\n\r\nFor all intended uses, the API compatibility is preserved. Unreasonable and possibly wrong uses like\r\n`delaxes(ax1, ax2)` or `delaxes(ax, mykwarg=True)` would raise an Exception after the change. In itself, this is a benefit, because these cases will then be detected as false usage. However it may break existing programs.\r\n\r\nBefore I do any pull requests, is there a policy how to handle such cases?\r\n\r\n- Do you want to change these things, or should they be left as they are:\r\n - for cases like the above one where arguments are directly resolved in the function/method?\r\n - for cases where the all the arguments are passed like e.g. `pyplot.savefig`?\r\n- Which branch should changes go into?\r\n\r\n\r\n","author":{"url":"https://github.com/timhoffm","@type":"Person","name":"timhoffm"},"datePublished":"2017-12-02T13:07:40.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":10},"url":"https://github.com/9912/matplotlib/issues/9912"}
| 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:d15118fc-76b3-de7a-89f0-ecb914675f17 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D024:3A486F:27D7075:3634BF6:6A53AD1D |
| html-safe-nonce | e156b3bd6136e88bac9a9f73ddc0100a4722baac3dbcfa9c9be02235eda3a845 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMDI0OjNBNDg2RjoyN0Q3MDc1OjM2MzRCRjY6NkE1M0FEMUQiLCJ2aXNpdG9yX2lkIjoiNzA2NjA2NDM3ODc5ODUxNzUzMyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 11d6435172cf8df44f32377d058e1be690e6e0e0f706a01f32aa2acb6694a9a2 |
| hovercard-subject-tag | issue:278682758 |
| 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/matplotlib/matplotlib/9912/issue_layout |
| twitter:image | https://opengraph.githubassets.com/f723ddb6fb7fb616331079c85e1b8332dec3fb01a9bc3bcfa4b5720e2a5ad861/matplotlib/matplotlib/issues/9912 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/f723ddb6fb7fb616331079c85e1b8332dec3fb01a9bc3bcfa4b5720e2a5ad861/matplotlib/matplotlib/issues/9912 |
| og:image:alt | There are a lot of *args, **kwargs signatures in the API. In many cases, they could be better described by explicit arguments/kw-arguments. This makes for a more clear API and reduces the chance of... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | timhoffm |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| turbo-cache-control | no-preview |
| go-import | github.com/matplotlib/matplotlib git https://github.com/matplotlib/matplotlib.git |
| octolytics-dimension-user_id | 215947 |
| octolytics-dimension-user_login | matplotlib |
| octolytics-dimension-repository_id | 1385122 |
| octolytics-dimension-repository_nwo | matplotlib/matplotlib |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1385122 |
| octolytics-dimension-repository_network_root_nwo | matplotlib/matplotlib |
| 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 | 07a982c1d40157c619b364352b704c3ce66bb332 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width