Skip to content

Commit

Permalink
sagemathgh-38602: Allow for python sets to be counted as sets
Browse files Browse the repository at this point in the history
    
<!-- ^ Please provide a concise and informative title. -->
<!-- ^ Don't put issue numbers in the title, do this in the PR
description below. -->
<!-- ^ For example, instead of "Fixes sagemath#12345" use "Introduce new method
to calculate 1 + 2". -->
<!-- v Describe your changes below in detail. -->
<!-- v Why is this change required? What problem does it solve? -->
<!-- v If this PR resolves an open issue, please link to it here. For
example, "Fixes sagemath#12345". -->

Fixes Issue sagemath#32265


### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->

- [x] The title is concise and informative.
- [x] The description explains in detail what this PR is about.
- [x] I have linked a relevant issue or discussion.
- [x] I have created tests covering the changes.
- [x] I have updated the documentation and checked the documentation
preview.

### ⌛ Dependencies

<!-- List all open PRs that this PR logically depends on. For example,
-->
<!-- - sagemath#12345: short description why this is a dependency -->
<!-- - sagemath#34567: ... -->
    
URL: sagemath#38602
Reported by: Aram Dermenjian
Reviewer(s): Travis Scrimshaw
  • Loading branch information
Release Manager committed Sep 8, 2024
2 parents a8d5783 + 8035d12 commit a0db75e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/sage/combinat/subset.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,8 +321,10 @@ def __contains__(self, value):
True
sage: 2 in S
False
sage: {1, 2} in S
True
"""
if value not in Sets():
if value not in Sets() and not isinstance(value, (set, frozenset)):
return False
return all(v in self._s for v in value)

Expand Down

0 comments on commit a0db75e

Please sign in to comment.