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

Ethan Furman ethan at stoneleaf.us
Thu May 23 22:19:20 CEST 2013


On 05/23/2013 01:10 PM, Łukasz Langa wrote:
> 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.

So with this decision made, are there any open issues left?  Or can we invite Guido back to the discussion?  ;)

--
~Ethan~


More information about the Python-Dev mailing list