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

Commit 9b4e224

Browse files
rwstMatthias Koeppe
authored and
Matthias Koeppe
committed
24176: check set argument of element_of()
1 parent 7d19916 commit 9b4e224

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/sage/functions/other.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2317,6 +2317,22 @@ def __init__(self):
23172317
"""
23182318
BuiltinFunction.__init__(self, "element_of", nargs=2)
23192319

2320+
def _eval_(self, x, s):
2321+
"""
2322+
EXAMPLES::
2323+
2324+
sage: from sage.functions.other import element_of
2325+
sage: element_of(x, SR(RealSet(-oo, oo)))
2326+
element_of(x, (-oo, +oo))
2327+
sage: element_of(x, 0)
2328+
Traceback (most recent call last):
2329+
...
2330+
ValueError: not a set: 0
2331+
"""
2332+
from sage.sets.set import is_Set
2333+
if not is_Set(s):
2334+
raise ValueError("not a set: {}".format(s))
2335+
23202336
def _latex_(self):
23212337
r"""
23222338
EXAMPLES::

0 commit comments

Comments
 (0)