Showing content from http://mail.python.org/pipermail/python-dev/attachments/20140205/098bbf33/attachment.html below:
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix"><br>
On 02/05/2014 05:52 AM, "Martin v. Löwis" wrote:<br>
</div>
<blockquote cite="mid:52F24226.4010903@v.loewis.de" type="cite">
<pre wrap="">D: Add a new type slot for method signatures. This would be a
tp_signature field, along with a new slot id Py_tp_signature. The
signature field itself could be
struct PyMethodSignature {
char *method_name;
char *method_signature;
};
</pre>
</blockquote>
<br>
That should work too, though we'd also have to add a md_signature
field to module objects.<br>
<br>
It would probably be best to merge the signature into the callable
object anyway. Otherwise we'd have to go look up the signature
using __name__ and __self__ / __objclass__ on demand. Maybe that
isn't such a big deal, but it gets a little worse: as far as I can
tell, there's no attribute on a type object one can use to find the
module it lives in. So in this situation:<br>
<blockquote>>>> import _pickle<br>
>>> import inspect<br>
>>> inspect.signature(_pickle.Pickler)<br>
</blockquote>
How could inspect.signature figure out that the "Pickler" type
object lives in the "_pickle" module? My best guess: parsing the
__qualname__, which is pretty ugly.<br>
<br>
Also, keeping the signature as a reasonably-human-readable preface
to the docstring means that, if we supported this for third-party
modules, they could be binary ABI compatible with 3.3 and still have
something approximating the hand-written signature at the top of
their docstring.<br>
<br>
Cheers,<br>
<br>
<br>
<i>/arry</i><br>
</body>
</html>
RetroSearch is an open source project built by @garambo
| Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4