Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
src/sage/sets/set.py: Simplify category checks as suggested
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthias Koeppe committed Aug 18, 2022
1 parent df327b9 commit 8a30493
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/sage/sets/set.py
Original file line number Diff line number Diff line change
Expand Up @@ -1368,12 +1368,12 @@ def __init__(self, X, Y, category=None):
"""
if category is None:
category = Sets()
if all(S in Sets().Finite() for S in (X, Y)):
category = category.Finite()
if all(S in Sets().Enumerated() for S in (X, Y)):
category = category.Enumerated()
if any(S in Sets().Infinite() for S in (X, Y)):
category = category.Infinite()
elif all(S in Sets().Finite() for S in (X, Y)):
category = category.Finite()
Set_object_binary.__init__(self, X, Y, "union", "\\cup", category=category)

def is_finite(self):
Expand Down Expand Up @@ -1713,11 +1713,11 @@ def __init__(self, X, Y, category=None):
"""
if category is None:
category = Sets()
if X in Sets().Finite():
category = category.Finite()
if X in Sets().Enumerated():
category = category.Enumerated()
if X in Sets().Infinite() and Y in Sets().Finite():
if X in Sets().Finite():
category = category.Finite()
elif X in Sets().Infinite() and Y in Sets().Finite():
category = category.Infinite()
Set_object_binary.__init__(self, X, Y, "difference", "-", category=category)

Expand Down

0 comments on commit 8a30493

Please sign in to comment.