-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Values Return From Set Methods #7147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Awesome you have come back to this! This went in as part of https://github.com/matplotlib/matplotlib/pull/5599/files I did that out of an abundance of caution to not change a different API. It looks like there are a handful of setters that do in fact return something. I do not see why they are incompatible: def set_foo(self, value):
self.foo = value
return self.foo but agree they should go long term. |
@tacaswell by "incompatible" I mean that if returning setters where an actual feature supported by matplotlib, there are certain setters that could not be replicated using traitlets. This kind of setter could be replicated with def set_foo(self, value):
new_value = change_it(value)
self.foo = new_value
return new_value However something like this could not: def set_foo(self, value):
new_value, byproduct = change_it(value)
self.foo = new_value
return byproduct |
From a quick skim it looks like all of the returning setters return the same thing as their paired getter (ex If there are any in the second class I am nominally 👍 on deprecating / addressing on a case-by-case basis. |
This issue has been marked "inactive" because it has been 365 days since the last comment. If this issue is still present in recent Matplotlib releases, or the feature request is still wanted, please leave a comment and this label will be removed. If there are no updates in another 30 days, this issue will be automatically closed, but you are free to re-open or create a new issue if needed. We value issue reports, and this procedure is meant to help us resurface and prioritize issues that have not been addressed yet, not make them disappear. Thanks for your help! |
I've decided to review my work merging traitlets into matplotlib #4762, and during my rebase I came across this change to
Artist.update
...https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/artist.py#L880
where
update
now handles values returned by setters.I'm wondering what the motivation is behind these setters with return values, because they are incompatible with
traitlets
. Iftraitlets
integration is to continue, these returning setters will need to be deprecated.cc: @tacaswell, @jenshnielsen, @efiring
The text was updated successfully, but these errors were encountered: