-
-
Notifications
You must be signed in to change notification settings - Fork 30.5k
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
Add __get__ to the partial object #121027
Comments
The "Does practicality beat purity?" question also applies here. Yes, if we'd had the placeholder functionality all along we might never have added |
I do not know. I have not found any issue which could be solved by adding |
For clarification, I do not oppose this feature. But there is a procedure for making breaking changes. It should not bit buried as a side effect of adding other feature. This can be worked around with significant core developer support if we decide the benefit of immediate change outweighs the risk. Or if we reclassify it as a bugfix. |
We are avoiding a problem that formerly didn't present itself. Partial is almost entirely understood as being an equivalent to a Without adding
When they learn about the non-equivalence, it will break their mental model of Next, they will have to discover a workaround with I don't think it should be acceptable to leave |
Also, I don't think there is much of a downside. The docs for There might be some minor disruption but it leads to a better designed more clear outcome than being trapped into a surprising behavior that was never intended. If |
As an option, we can add It may be late for a beta stage, but the premise is that it will not affect much user code. If this is true, adding it in 3.13 is safe. If it is not true, it is still better than breaking that code without a warning. Surprisingly, it only breaks few recently added tests in the CPython test suite, and these tests were added specially to test how the code handles such weird corner case. They do not establish the correct behavior, they test that the current behavior will not be changed unintentionally. cc @Yhg1s as the RM |
+1 for adding a FutureWarning to 3.13 if it is still possible. I expect that people with encounter it rarely and that the workaround is to just wrap It would also be reasonable to just put a note in the docs. This wasn't a behavior previously promised in the docs and isn't something that people would typically encounter. I've taught
|
Co-authored-by: d.grigonis <dgrigonis@users.noreply.github.com>
Co-authored-by: d.grigonis <dgrigonis@users.noreply.github.com>
…ythonGH-121086) (cherry picked from commit db96edd) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: d.grigonis <dgrigonis@users.noreply.github.com>
Thanks for doing this. |
…121089) Co-authored-by: d.grigonis <dgrigonis@users.noreply.github.com>
I'm not sure whether your comment "This is a breaking change" is intended to refer to the future change to make the |
It referred to the future change, but, unfortunately, adding even trivial |
pythonGH-121089) Co-authored-by: d.grigonis <dgrigonis@users.noreply.github.com>
pythonGH-121089) Co-authored-by: d.grigonis <dgrigonis@users.noreply.github.com>
Feature or enhancement
In #119827 (comment), @rhettinger proposed to add the
__get__
method to thepartial
object infunctools
. This is a breaking change, although the impact may be much lesser than of adding__get__
to builtin functions. But we should follow the common procedure for such changes: first add__get__
that emits FutureWarning with suggestion to wrap partial into staticmethod and return thepartial
object unchanged, then change the behavior few releases later.Linked PRs
The text was updated successfully, but these errors were encountered: