Title: Implement wrapper functions with decorators instead of __getattribute__ · Issue #37 · proplot-dev/proplot · GitHub
Open Graph Title: Implement wrapper functions with decorators instead of __getattribute__ · Issue #37 · proplot-dev/proplot
X Title: Implement wrapper functions with decorators instead of __getattribute__ · Issue #37 · proplot-dev/proplot
Description: So far, I have been implementing all plot method wrappers by applying them in __getattribute__ on the axes classes. This is pretty "hacky" and unexpected for new contributors. On the "Axes and related wrappers" page of the documentation,...
Open Graph Description: So far, I have been implementing all plot method wrappers by applying them in __getattribute__ on the axes classes. This is pretty "hacky" and unexpected for new contributors. On the "Axes and rela...
X Description: So far, I have been implementing all plot method wrappers by applying them in __getattribute__ on the axes classes. This is pretty "hacky" and unexpected for new contributors. On the &quo...
Opengraph URL: https://github.com/proplot-dev/proplot/issues/37
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Implement wrapper functions with decorators instead of __getattribute__","articleBody":"So far, I have been implementing all plot method wrappers by applying them in `__getattribute__` on the axes classes. This is pretty \"hacky\" and unexpected for new contributors. On the \"[Axes and related wrappers](https://proplot.readthedocs.io/en/latest/axes.html)\" page of the documentation, I defend this choice as reducing the source code size. Originally, I also avoided this because the [automodapi sphinx extension](https://proplot.readthedocs.io/en/latest/axes.html) used to generate ProPlot documentation inherits docstrings from identically-named methods on parent classes. In my [fork of automodapi](https://proplot.readthedocs.io/en/latest/axes.html), this is no longer the case -- if the docstring is empty (i.e. `func.__doc__` is empty), automodapi skips that method. I prefer to document ProPlot enhancements of matplotlib axes methods separately, so users calling e.g. `help(ax.contourf)` get the native matplotlib docstring.\r\n\r\nIn the future, I'd like to implement all wrappers using decorators, which is more verbose but probably falls under the [Simple is better than complex](https://www.python.org/dev/peps/pep-0020/) category. There are also several places in the wrapper functions where I apply function-specific behavior -- e.g. in `cmap_wrapper`, various `if func.__name__ == 'contour'` statements. With decorators, it will be easier to implement method-specific behavior and easier to debug issues.","author":{"url":"https://github.com/lukelbd","@type":"Person","name":"lukelbd"},"datePublished":"2019-09-11T17:52:07.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/37/proplot/issues/37"}
| 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:9dbf0235-3c38-35a6-1739-0228adba5db7 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | EDF2:3C56CA:89DC51:B3C0BC:697E2FE4 |
| html-safe-nonce | 43043b34429d5a49c6e7eac3d1425f76ae8412fb166677e466e69f7eeb3c50f8 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFREYyOjNDNTZDQTo4OURDNTE6QjNDMEJDOjY5N0UyRkU0IiwidmlzaXRvcl9pZCI6IjMyMTU2NTg0MDU4ODAyNzkwMTIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 5d24c9158ad9abca9b114a0666c17ef65fb41a8319e32f002620eba16626660d |
| hovercard-subject-tag | issue:492380335 |
| 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/proplot-dev/proplot/37/issue_layout |
| twitter:image | https://opengraph.githubassets.com/2b5826fa3b3542df5408ff853b46a92d88b85543b2a710efe3e666e4e70f5642/proplot-dev/proplot/issues/37 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/2b5826fa3b3542df5408ff853b46a92d88b85543b2a710efe3e666e4e70f5642/proplot-dev/proplot/issues/37 |
| og:image:alt | So far, I have been implementing all plot method wrappers by applying them in __getattribute__ on the axes classes. This is pretty "hacky" and unexpected for new contributors. On the "Axes and rela... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | lukelbd |
| hostname | github.com |
| expected-hostname | github.com |
| None | 60279d4097367e16897439d16d6bbe4180663db828c666eeed2656988ffe59f6 |
| turbo-cache-control | no-preview |
| go-import | github.com/proplot-dev/proplot git https://github.com/proplot-dev/proplot.git |
| octolytics-dimension-user_id | 108025793 |
| octolytics-dimension-user_login | proplot-dev |
| octolytics-dimension-repository_id | 113293661 |
| octolytics-dimension-repository_nwo | proplot-dev/proplot |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 113293661 |
| octolytics-dimension-repository_network_root_nwo | proplot-dev/proplot |
| 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 | 7c85641c598ad130c74f7bcc27f58575cac69551 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width