On Oct 14, 2016, at 8:49 AM, python-dev-request at python.org wrote: > Date: Fri, 14 Oct 2016 14:11:18 +1300 > From: Tim Mitchell <tim.mitchell at leapfrog3d.com> > It would be nice if the @singledispatch decorator worked on instance > methods. > I have a reference implementation on pypi that does this ( > https://pypi.python.org/pypi/methoddispatch). You might be interested in this thread from my multimethod library: https://bitbucket.org/coady/multimethod/issues/2/ <https://bitbucket.org/coady/multimethod/issues/2/>. It was a feature request for multiple dispatch to work on instance methods. I implemented a variation where the initial self argument still contributed to the dispatch. I think the same reasoning would apply in the single dispatch case: that it’s not obvious the “dispatch” would occur once on the self argument to find the method, and then again on the “first” argument. Especially since Py3 did away with bound methods, so you can call a method through its class and explicitly supply self as the first argument. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20161016/068006cc/attachment.html>
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4