On Thu, May 23, 2013 at 2:59 PM, PJ Eby <p...@telecommunity.com> wrote:
> I generally lean towards returning the undecorated function, so that if you 
> say:
>
>     @func.register
>     def do_int(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.
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to