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/126490.html below:

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

[Python-Dev] PEP 443 - Single-dispatch generic functionsŁukasz Langa lukasz at langa.pl
Thu May 23 22:10:03 CEST 2013
On 23 maj 2013, at 20:59, PJ Eby <pje at telecommunity.com> wrote:

> As to the ability to do multiple types registration, you could support
> it only in type annotations, e.g.:
> 
>    @func.register
>    def doit(foo: [int, float]):
>        ...

Initially I thought so, too. But it seems other people might think this
means "a sequence with the first element being an integer, and the second
a float". The BDFL seems to have yet a different idea:

http://mail.python.org/pipermail/python-ideas/2012-December/018129.html

This is clearly material for a separate PEP, wink wink, nudge nudge.

To the point though. Based on this, and the fact PEP 8 currently disallows
annotations within the standard library, I came to the conclusion that
currently we should not include the annotation-driven form.

> I generally lean towards returning the undecorated function, so that if you say:
> 
>    @func.register
>    def do_int(foo: int):
>        ...

Me too. The PEP has been updated to specify that explicitly.

-- 
Best regards,
Łukasz Langa

WWW: http://lukasz.langa.pl/
Twitter: @llanga
IRC: ambv on #python-dev

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