This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Argument Clinic: add ability to specify an existing impl function
Type: enhancement Stage: resolved
Components: Demos and Tools Versions: Python 3.4, Python 3.5
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: Nosy List: larry, loewis, zach.ware
Priority: low Keywords:

Created on 2014-07-28 21:02 by zach.ware, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (4)
msg224188 - (view) Author: Zachary Ware (zach.ware) * (Python committer) Date: 2014-07-28 21:08
It would be nice to be able to specify an existing function as the _impl function, for cases like winreg.OpenKey and OpenKeyEx which are the same function by different names, or _winapi.GetCurrentProcess, whose impl function is "return GetCurrentProcess()".

This is pretty minor, but would allow for some shorter and cleaner code.  Unfortunately, I don't have any great ideas for syntax for this, so it may be rejected just on that basis.
msg224218 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2014-07-29 09:44
I don't think it it is worth the effort. You would need two different entry functions still, to allow error messages to refer to the function name. Since the _impl functions can trivially call each other, the saving in lines of code are minimal, and from a code reading point of view, having aliases actually complicates the code.
msg224221 - (view) Author: Larry Hastings (larry) * (Python committer) Date: 2014-07-29 11:20
I'm with Martin. It would be a funny exception, where the reader'd get confused... why is the impl missing? 

Also, any halfway-decent optimizer will inline the impl into the parsing function, so this has no runtime cost.
msg224505 - (view) Author: Zachary Ware (zach.ware) * (Python committer) Date: 2014-08-01 14:25
Fair enough.
History
Date User Action Args
2022-04-11 14:58:06adminsetgithub: 66294
2014-08-01 14:25:28zach.waresetstatus: open -> closed
resolution: rejected
messages: + msg224505

stage: resolved
2014-07-29 11:20:42larrysetmessages: + msg224221
2014-07-29 09:44:14loewissetnosy: + loewis
messages: + msg224218
2014-07-28 21:08:56zach.waresetpriority: normal -> low

messages: + msg224188
2014-07-28 21:02:31zach.warecreate