◐ Shell
reader mode source ↗
Skip to content

bpo-32380: Create functools.singledispatchmethod#6306

Merged
ambv merged 8 commits into
python:masterfrom
emmatyping:dispatchmethod
May 26, 2018
Merged

bpo-32380: Create functools.singledispatchmethod#6306
ambv merged 8 commits into
python:masterfrom
emmatyping:dispatchmethod

Conversation

@emmatyping

@emmatyping emmatyping commented Mar 29, 2018

Copy link
Copy Markdown
Member

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

functools.singledispatch interacts poorly with methods and descriptors,
thus functools.singledispatchmethod is created to handles these.
@emmatyping

Copy link
Copy Markdown
Member Author

Hm, I'm not sure what is going on with the unexpected indent here. It seems valid.

@ambv ambv left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hide comment

This looks promising, thanks for working on it.

@bedevere-bot

Copy link
Copy Markdown

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 I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@emmatyping

Copy link
Copy Markdown
Member Author

I have made the requested changes; please review again

Thanks for the review Łukasz!

@bedevere-bot

Copy link
Copy Markdown

Thanks for making the requested changes!

@ambv: please review the changes made to this pull request.

@ncoghlan ncoghlan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hide comment

Some documentation suggests inline, but I otherwise don't have anything to add to @ambv's comments.

Nice work on remembering to test the interactions with other standard library decorators!

@emmatyping

Copy link
Copy Markdown
Member Author

@ncoghlan thanks for the suggestions! I amended the docs as you asked.

@ambv ambv left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hide 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.

@emmatyping

Copy link
Copy Markdown
Member Author

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.

Done! Let me know if you have further feedback.

@ambv

ambv commented Mar 30, 2018

Copy link
Copy Markdown
Contributor

I'll wait a few days before merging in case @rhettinger has any input.

@ilevkivskyi

Copy link
Copy Markdown
Member

What is the status here? This seems ready to be merged. (Or maybe it should also support annotations like @singledispatch does now ;-))

@emmatyping

Copy link
Copy Markdown
Member Author

@ambv ambv merged commit c651275 into python:master May 26, 2018
@bedevere-bot

Copy link
Copy Markdown

@ambv: Please replace # with GH- in the commit message next time. Thanks!

@ambv

ambv commented May 26, 2018

Copy link
Copy Markdown
Contributor

Thanks! ✨ 🍰 ✨

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants