[Python-ideas] Default decorator?
Guido van Rossum
guido at python.org
Thu Jan 17 01:31:52 CET 2008
Peter Norvig suggested an idea to me over lunch: a "default
decorator". This would be something you could set once per module and
it would be invoked for each function definition in the same way as a
decorator is invoked, before any explicit decorators. His use case was
something that wraps every function that uses argument annotations
with something that interprets those annotations in a certain way and
enforces that interpretation. It would save having to explicitly
annotate every function or method that way.
Thoughts? I suggested that a metaclass could do this for methods, but
that of course leaves plain functions in the lurch.
--
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-ideas
mailing list