[Python-Dev] PEP 318: Preserve function signatures (original) (raw)

Michael Hudson mwh at python.net
Tue Mar 30 06:30:43 EST 2004


Ka-Ping Yee <python-dev at zesty.ca> writes:

There has been some discussion about whether decorators are required to be callable, accept callables, or return callables.

I would like to ask that the PEP recommend (perhaps strongly, but not require) that decorators preserve function argument signatures whenever it is reasonable to do so. (That is, given a three-argument function returning a string, a typical decorator should produce another three- argument function returning a string.)

Careful, here.

callable(classmethod(lambda cls:1)) False

I agree with the spirit of your suggestion, though.

[...]

This need not be enforced by any interpreter mechanism. I just think it should be the encouraged practice.

And (very much) with this.

Cheers, mwh

-- Programming languages should be designed not by piling feature on top of feature, but by removing the weaknesses and restrictions that make the additional features appear necessary. -- Revised(5) Report on the Algorithmic Language Scheme



More information about the Python-Dev mailing list