-
-
Notifications
You must be signed in to change notification settings - Fork 33.2k
gh-140382: Add support for __getattr__
method to Argument Clinic
#140376
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
base: main
Are you sure you want to change the base?
Conversation
Could you create a new issue for this, and tag people interested in AC? |
I can create a new issue, but all CODEOWNERs have already been notified. Do you have anyone else in mind? |
__getattr__
method to Argument Clinic__getattr__
method to Argument Clinic
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't it make more sense to just support arbitrary dunder methods? __getattr__
isn't very common in C code, among other things.
I'm also not convinced this is worth it. A |
On the other hand, I would be very supportive of allowing arbitrary dunders in AC, though I suspect that would be a lot of extra work (because we would need to map dunders to |
No, it’s just the general principle that «should we do?» discussions happen in issues (and when needed on the forums), then the PR can host «how to do?» discussions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't it make more sense to just support arbitrary dunder methods?
I think it's ok to add support of specific dunders on-demand. It's not too helpful in general, because sometimes we can do too much with slots, even override the docstring.
But please think about more generic case. For example, for most dunders we have very specific function signatures. It will be redundant and error-prone to specify this stuff by hand.
Modules/zlibmodule.c
Outdated
/*[clinic input] | ||
zlib.__getattr__ | ||
name: object |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
name: object | |
name: str |
I think we want here a string, isn't? And remove PyUnicode_Check() in zlib___getattr__()
Also, we want this always. Maybe per-default the AC should set an appropriate signature?
__getattr__
method in AC #140382