| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
I am not super happy with the implementation : _api.check_in_list(["all", "row", "col", "none", 0, 1, False, True]The error message is clearer but with the if conditions above, False, True, 0 and 1 are not actually values that can be passed to sharex and sharey. In this case their value is changed to 'all' or 'none'. |
Sorry, something went wrong.
There was a problem hiding this comment.
Thank you for opening your first PR into Matplotlib!
If you have not heard from us in a while, please feel free to ping @matplotlib/developers or anyone who has commented on the PR. Most of our reviewers are volunteers and sometimes things fall through the cracks.
You can also join us on gitter for real-time discussion.
For details on testing, writing docs, and our review process, please see the developer guide
We strive to be a welcoming and open project. Please follow our Code of Conduct.
Sorry, something went wrong.
There was a problem hiding this comment.
If I have understood the dev cal discussion from yesterday correctly, the way forward here is not special-handling 0 and 1 but
if isinstance(sharex, str):
...
else:
sharex = "all" if sharex else "none"
Sorry, something went wrong.
Sorry, something went wrong.
|
Yes very clear, thanks for the feedback ! I will implement it when I have some time. |
Sorry, something went wrong.
|
I implemented what you suggested, but there are still two points that bother me and to which I did not find an elegant solution (yet):
|
Sorry, something went wrong.
The fundamental issue here is that the logic needs special handling of some of the existing values. Thus, the _check_in_list() site does not see the full range of possible values. As long as we build the message from the check list, we either lack allowed values in the message or we have to extend the list beyond what can actually be used in the current context. I'm mostly ok to have the extra values in here. - The alternative would be to expand the semantics of the _print_supported_values parameter so that we can do: check_in_list(
["all", "row", "col", "none"],
_print_supported_values=["all", "row", "col", "none", True, False],
sharex=sharex, sharey=sharey)
Yes. To be clear: Conceptually, we don't accept special values 0, 1 as synonyms to True and False. We only support the concept of duck-typing, which says that you can pass any truthy or falsy values. This is also what happens in most cases automatically when you have conditions like if sharex:. N.b.: For that reason, the check in list message should not list 0, 1 explicitly. |
Sorry, something went wrong.
|
Thanks you for the feedback ! I better understand the logic. |
Sorry, something went wrong.
There was a problem hiding this comment.
Please do not remove the test.
Anyone can dismiss this review.
Sorry, something went wrong.
|
@vdbma are you still interested in working on this PR? I'm going to push this to 3.8, but if it is done there is no reason it can not be merged for 3.7. |
Sorry, something went wrong.
|
Yes, very much so ! Sorry for the late contribution. |
Sorry, something went wrong.
|
As of now the documentation for sharex says:
Should I change it so that it is explicit that non-str values will be cast to boolean or should it remain an implicit behaviour ? |
Sorry, something went wrong.
|
Please leave it as is. The primary logic type here is bool. That many things can be interpreted as bool is a language property of Python, which is often used. It would be rather distracting to mention this in every context that supports it. |
Sorry, something went wrong.
Great and no worries! |
Sorry, something went wrong.
|
This could do with a squash, by you if you're comfortable with it, or at merge time. |
Sorry, something went wrong.
|
I've squashed during merge. @vdbma thanks, and congratulations on your first contribution to Matplotlib! We hope to see you again. |
Sorry, something went wrong.
Co-authored-by: Marc Van den Bossche <marc.vanden-bossche@univ-grenoble-alpes.fr>
Co-authored-by: Marc Van den Bossche <marc.vanden-bossche@univ-grenoble-alpes.fr>
Co-authored-by: Marc Van den Bossche <marc.vanden-bossche@univ-grenoble-alpes.fr>
Co-authored-by: Marc Van den Bossche <marc.vanden-bossche@univ-grenoble-alpes.fr>
| Back | FazBrowse Home | New Git URL |
PR Summary
This PR allows to use either 0 or 1 in place of False or True in sharex and sharey options. Fixes #24349.
PR Checklist
Tests and Styling
Documentation
Release Notes