bpo-32380: Create functools.singledispatchmethod#6306
Conversation
functools.singledispatch interacts poorly with methods and descriptors, thus functools.singledispatchmethod is created to handles these.
|
Hm, I'm not sure what is going on with the unexpected indent here. It seems valid. |
Sorry, something went wrong.
ambv
left a comment
There was a problem hiding this comment.
This looks promising, thanks for working on it.
Sorry, something went wrong.
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
Sorry, something went wrong.
|
I have made the requested changes; please review again Thanks for the review Łukasz! |
Sorry, something went wrong.
|
Thanks for making the requested changes! @ambv: please review the changes made to this pull request. |
Sorry, something went wrong.
|
@ncoghlan thanks for the suggestions! I amended the docs as you asked. |
Sorry, something went wrong.
ambv
left a comment
There was a problem hiding this comment.
This is almost there. Two remaining requests:
- in the Negator example in the docs, use cls, not self
- in the tests, use registered implementations which actually use the relevant cls or self to prove they bind correctly; especially in the arbitrary callable case.
Sorry, something went wrong.
Done! Let me know if you have further feedback. |
Sorry, something went wrong.
|
I'll wait a few days before merging in case @rhettinger has any input. |
Sorry, something went wrong.
|
What is the status here? This seems ready to be merged. (Or maybe it should also support annotations like |
Sorry, something went wrong.
|
@ilevkivskyi waiting on naming approval. Also, It does support annotations see https://github.com/python/cpython/pull/6306/files#diff-09cc1e5ad87c6bd130e5b417193ed883R2251 |
Sorry, something went wrong.
|
@ambv: Please replace |
Sorry, something went wrong.
|
Thanks! ✨ 🍰 ✨ |
Sorry, something went wrong.
I finally found time to follow up after #4987. In review: functools.singledispatch interacts poorly with methods and descriptors, thus I created functools.singledispatchmethod to handles these.
This implementation is based on that of
functools.partialmethod.https://bugs.python.org/issue32380