A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2013-May/126460.html below:

[Python-Dev] PEP 443 - Single-dispatch generic functions

[Python-Dev] PEP 443 - Single-dispatch generic functionsNick Coghlan ncoghlan at gmail.com
Thu May 23 04:12:26 CEST 2013
On Thu, May 23, 2013 at 10:14 AM, Glenn Linderman <v+python at g.nevcal.com> wrote:
> Yet about half of the operator overloads would be incomplete if there were
> not corresponding __r*__ methods (__radd__, __rsub__, etc.) because the
> second parameter is as key to the dispatch as the first.
>
> While unary operators, and one argument functions would be fully covered by
> single dispatch, it is clear that single dispatch doesn't cover a large
> collection of useful cases for operator overloading.

The binary operators can be more accurately said to use a complicated
single-dispatch dance rather than supporting native dual-dispatch. As
you say, the PEP would be strengthened by pointing this out as an
argument in favour of staying *away* from a multi-dispatch system
(because it isn't obvious how to build a comprehensible one that would
even support our existing NotImplemented based dual dispatch system
for the binary operators).

Cheers,
Nick.

--
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
More information about the Python-Dev mailing list

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