Input args to Union must be Sets
Package:
sympy
8356
Exception Class:
TypeError
Raise code
# ===== Global Rules =====
if not args:
return S.EmptySet
for arg in args:
if not isinstance(arg, Set):
raise TypeError("Input args to Union must be Sets")
# Merge all finite sets
finite_sets = [x for x in args if x.is_FiniteSet]
if len(finite_sets) > 1:
a = (x for set in finite_sets for x in set)
finite_set = FiniteSet(*a)
args = [finite_set] + [x for x in args if not x.is_FiniteSet]
Links to the raise (2)
https://github.com/sympy/sympy/blob/2c83657ff1c62fc2761b639469fdac7f7561a72a/sympy/sets/sets.py#L2359 https://github.com/sympy/sympy/blob/2c83657ff1c62fc2761b639469fdac7f7561a72a/sympy/sets/sets.py#L2414Ways to fix
def Union(a,b):
if a == True and b == True:
return True
return False
A = True
B = True
C = True
D = True
E = True
A_B = Union (A, B)
C_D = select (C,D)
C_D_E = select(C_D,E)
ab = Union(A_B,C_D_E)
print(ab)
Add a possible fix
Please authorize to post fix