type.__signature__ (and Argument Clinic)
We now have a useful function signature abstraction in 3.3 with PEP 362. An outgrowth of this has been Larry Hasting's efforts on Argument Clinic. One open question is (was?) how to give a docstring to the C versions of __new__ and __init__. Though in the morning I may wonder what I was thinking, here's a possibility that popped into my head: let classes have a __signature__ attribute that is the signature for meta.__call__, as well as cls.__new__ and cls.__init__. This makes sense since the three methods are, together, the default factory for instances of the type. One would expect them to have the same signature. Keeping that signature on the class parallels how it is kept on function objects (rather than on func.__call__). Thoughts? -eric
On Thu, Mar 28, 2013 at 9:26 PM, Eric Snow <ericsnowcurrently@gmail.com> wrote:
We now have a useful function signature abstraction in 3.3 with PEP 362. An outgrowth of this has been Larry Hasting's efforts on Argument Clinic. One open question is (was?) how to give a docstring to the C versions of __new__ and __init__.
In case anyone else doesn't follow python-dev and was wondering what Argument Clinic was: http://mail.python.org/pipermail/python-dev/2012-December/122920.html – Chris
(+Mark and Larry who might not be on this list) On Thu, Mar 28, 2013 at 10:40 PM, Chris Rebert <pyideas@rebertia.com> wrote:
On Thu, Mar 28, 2013 at 9:26 PM, Eric Snow <ericsnowcurrently@gmail.com> wrote:
We now have a useful function signature abstraction in 3.3 with PEP 362. An outgrowth of this has been Larry Hasting's efforts on Argument Clinic. One open question is (was?) how to give a docstring to the C versions of __new__ and __init__.
In case anyone else doesn't follow python-dev and was wondering what Argument Clinic was: http://mail.python.org/pipermail/python-dev/2012-December/122920.html
How funny. I hadn't noticed that all the discussions on Argument Clinic have taken place on python-dev. Thanks for pointing that out, Chris. You can also check out PEPs 436 and 437 [1][2]. -eric [1] http://www.python.org/dev/peps/pep-0436/ [2] http://www.python.org/dev/peps/pep-0437/
participants (2)
-
Chris Rebert
-
Eric Snow