[Python-Dev] Decorators: vertical bar syntax (original) (raw)

Guido van Rossum guido at python.org
Mon Aug 9 17:16:38 CEST 2004


A motivation for this was that one of the examples

@accepts(int,int) @returns(float) def bar(low,high): which separates related information too much for me. If decorators need to decorate parameters, they are more likely to be understood correctly by a reader if the decorations are next to the parameters.

Let's make one thing clear; while decorators may be useful for some to experiment with attaching signatures to methods, mainstream Python will eventually have optional static typing built in, and it won't use decorator syntax. (More likely you would specify argument types by saying e.g. "def bar(low: int, high: int) -> float: ...")

--Guido van Rossum (home page: http://www.python.org/~guido/)



More information about the Python-Dev mailing list