We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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?
to your account
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
assignee = 'https://github.com/rhettinger'
closed_at = <Date 2022-04-06.17:05:20.544>
created_at = <Date 2022-02-11.15:15:23.893>
labels = ['interpreter-core', '3.11', 'performance']
title = 'Optimize set.issuperset() for non-set argument'
updated_at = <Date 2022-04-06.17:05:20.543>
user = 'https://github.com/serhiy-storchaka'
activity = <Date 2022-04-06.17:05:20.543>
actor = 'serhiy.storchaka'
assignee = 'rhettinger'
closed = True
closed_date = <Date 2022-04-06.17:05:20.544>
closer = 'serhiy.storchaka'
components = ['Interpreter Core']
creation = <Date 2022-02-11.15:15:23.893>
creator = 'serhiy.storchaka'
dependencies = 
files = 
hgrepos = 
issue_num = 46721
keywords = ['patch']
message_count = 3.0
messages = ['413075', '413076', '416887']
nosy_count = 2.0
nosy_names = ['rhettinger', 'serhiy.storchaka']
pr_nums = ['31280']
priority = 'normal'
resolution = 'fixed'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'performance'
url = 'https://bugs.python.org/issue46721'
versions = ['Python 3.11']
The text was updated successfully, but these errors were encountered:
If the argument of set.issuperset() is not a set, it is first converted to a set. It is equivalent to the following code:
if not isinstance(other, (set, frozenset)):
other = set(other)
# The following is equivalent to:
# return set.issubset(other, self)
for x in other:
if x not in self
Two drawbacks of this algorithm:
The proposed PR straightforward the code. The C code is now larger, but it no longer need additional memory, performs less operations and can stop earlier.
Sorry, something went wrong.
The new code is similar to the code of set.isdisjoint(), so we can share the code if generalize it.
New changeset a69a4a9 by Serhiy Storchaka in branch 'main':
bpo-46721: Optimize set.issuperset() for non-set arguments (GH-31280)
No branches or pull requests