Skip to content

Commit

Permalink
Undo adding is_empty to Parent and add it to FiniteWords
Browse files Browse the repository at this point in the history
  • Loading branch information
user202729 committed Feb 4, 2025
1 parent 31a802f commit ed25f5f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
13 changes: 13 additions & 0 deletions src/sage/combinat/words/words.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,19 @@ def __init__(self, alphabet=None, category=None):
category = category.Finite()
super().__init__(alphabet, category)

def is_empty(self):
"""
Return False, because the empty word is in the set.
TESTS::
sage: FiniteWords('ab').is_empty()
False
sage: FiniteWords([]).is_empty()
False
"""
return False

def cardinality(self):
r"""
Return the cardinality of this set.
Expand Down
7 changes: 0 additions & 7 deletions src/sage/structure/parent.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1235,13 +1235,6 @@ cdef class Parent(sage.structure.category_object.CategoryObject):
"""
return True

def is_empty(self):
"""
Default implementation of the method :meth:`is_empty`.
Delegates to :meth:`__bool__`.
"""
return not bool(self)

# Should be moved and merged into the EnumeratedSets() category (#12955)
def __getitem__(self, n):
"""
Expand Down

0 comments on commit ed25f5f

Please sign in to comment.