-
-
Notifications
You must be signed in to change notification settings - Fork 31.5k
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
gh-129622: Clarify the set.is{sub,super}set
docstrings
#129637
base: main
Are you sure you want to change the base?
Conversation
AA-Turner
commented
Feb 4, 2025
•
edited by bedevere-app
bot
Loading
edited by bedevere-app
bot
- Issue: Improve the frozenset.is(sub|super)set docstrings #129622
@@ -2066,12 +2066,12 @@ set.issuperset | |||
other: object | |||
/ | |||
|
|||
Report whether this set contains another set. | |||
Return True if the set is a superset of other. |
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.
IIUC, the OP issue is about return value. I think we can replace "report" with "Return True if", but why change the rest? Superset/subset - terminology, that might be unfamiliar to readers.
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.
My specific suggestion was "Return True if self is a subset of other, else False.", with changing 'Report' with 'Return' the prime focus. I do not know if 'if else' is needed. Without looking around, I suspect both implicit and explicit alternatives are used and would be satified either way.
I used the parameter names (marked as italicized) as that is a general policy. For frozenset, the parameter names are used in all the dunder docstrings (but without *s) but never with the non-dunder functions. The look sloppy to me. The non-specific 'another set' seems weird to me compared to the specific 'other'. As for the superset relationship , the rewording of the repetitious 'is superset' as 'contains' (and similarly for 'is subset') is fine with me and even a good idea. My revised suggestion would then be "Return True if self contains other." and "Return True if other contains self." (both without or with ", else False")
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.
As far as I can tell, none of the docstrings in setobject.c
use 'self'. Other docstrings in the module reference self as "a" / "this" / "the" set. Perhaps?:
Return True if this set contains other.
and Return True if this set is contained by other.
My slight preference for {sub/super}set is as "contains" is ambiguous for the case of set equality, where both methods return True
.
Test failure (Check if generated files are up to date) is build failure of |
Thoughts:
|