[Python-Dev] PEP 443 - Single-dispatch generic functions (original) (raw)

PJ Eby pje at telecommunity.com
Thu May 23 21:01:36 CEST 2013


On Thu, May 23, 2013 at 2:59 PM, PJ Eby <pje at telecommunity.com> wrote:

I generally lean towards returning the undecorated function, so that if you say:

@func.register def doint(foo: int): ...

Oops, forgot to mention: one other advantage to returning the undecorated function is that you can do this:

@func.register(int)
@func.register(float)
def do_num(foo):
   ...

Which neatly solves the multiple registration problem, even without argument annotations.



More information about the Python-Dev mailing list