Le 23/05/2013 16:10, Łukasz Langa a écrit : >> Does this work if the implementation function is called like the first >> decorated function? > No, the ``register()`` attribute returns the undecorated function which > enables decorator stacking, as well as creating unit tests for each > variant independently.
Perfect. My web framework of choice uses decorators that register things and return the function as is and I love it. I guess the common pattern will be to use variants of the generic function name, e.g. func is implemented by func_int, func_str and co, which also helps debugging. >> Making generic functions work with ABCs sounds like a requirement to me > Yes, I will implement that. Great! >> Question: what happens if two functions (say in two different modules) >> are registered for the same type? > Last one wins. Just like with assigning names in a scope, defining methods > in a class or overriding them in a subclass. Works for me. Cheers _______________________________________________ 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