Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Argument Clinic: add ability to specify an existing impl function #66294

Closed
zware opened this issue Jul 28, 2014 · 4 comments
Closed

Argument Clinic: add ability to specify an existing impl function #66294

zware opened this issue Jul 28, 2014 · 4 comments
Labels
type-feature A feature request or enhancement

Comments

@zware
Copy link
Member

zware commented Jul 28, 2014

BPO 22096
Nosy @loewis, @larryhastings, @zware

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2014-08-01.14:25:28.332>
created_at = <Date 2014-07-28.21:02:31.346>
labels = ['type-feature']
title = 'Argument Clinic: add ability to specify an existing impl function'
updated_at = <Date 2014-08-01.14:25:28.331>
user = 'https://github.com/zware'

bugs.python.org fields:

activity = <Date 2014-08-01.14:25:28.331>
actor = 'zach.ware'
assignee = 'none'
closed = True
closed_date = <Date 2014-08-01.14:25:28.332>
closer = 'zach.ware'
components = ['Demos and Tools']
creation = <Date 2014-07-28.21:02:31.346>
creator = 'zach.ware'
dependencies = []
files = []
hgrepos = []
issue_num = 22096
keywords = []
message_count = 4.0
messages = ['224188', '224218', '224221', '224505']
nosy_count = 3.0
nosy_names = ['loewis', 'larry', 'zach.ware']
pr_nums = []
priority = 'low'
resolution = 'rejected'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'enhancement'
url = 'https://bugs.python.org/issue22096'
versions = ['Python 3.4', 'Python 3.5']

@zware zware added the type-feature A feature request or enhancement label Jul 28, 2014
@zware
Copy link
Member Author

zware commented Jul 28, 2014

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.

@loewis
Copy link
Mannequin

loewis mannequin commented Jul 29, 2014

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.

@larryhastings
Copy link
Contributor

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.

@zware
Copy link
Member Author

zware commented Aug 1, 2014

Fair enough.

@zware zware closed this as completed Aug 1, 2014
@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

2 participants