[Python-Dev] decorator module in stdlib?

P.J. Eby pje at telecommunity.com
Wed Apr 8 20:41:13 CEST 2009

At 10:51 AM 4/8/2009 -0700, Guido van Rossum wrote:
>I would like it even less if an API cared about the
>*actual* signature of a function I pass into it.

One notable use of callable argument inspection is Bobo, the 
12-years-ago predecessor to Zope, which used argument information to 
determine form or query string parameter names.  (Were Bobo being 
written for the first time today for Python 3, I imagine it would use 
argument annotations to specify types, instead of requiring them to 
be in the client-side field names.)

Bobo, of course, is just a single case of the general pattern of 
tools that expose a callable to some other (possibly 
explicitly-typed) system.  E.g., wrapping Python functions for 
exposure to C, Java, .NET, CORBA, SOAP, etc.

Anyway, it's nice for decorators to be transparent to inspection when 
the decorator doesn't actually modify the calling signature, so that 
you can then use your decorated functions with tools like the above.

More information about the Python-Dev mailing list