From ed25f5fefe5b60c28906b4d4f357c59524bcb663 Mon Sep 17 00:00:00 2001 From: user202729 <25191436+user202729@users.noreply.github.com> Date: Tue, 4 Feb 2025 14:03:27 +0700 Subject: [PATCH] Undo adding is_empty to Parent and add it to FiniteWords --- src/sage/combinat/words/words.py | 13 +++++++++++++ src/sage/structure/parent.pyx | 7 ------- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/sage/combinat/words/words.py b/src/sage/combinat/words/words.py index 8d6bb2a57fe..e9e79f1f4c0 100644 --- a/src/sage/combinat/words/words.py +++ b/src/sage/combinat/words/words.py @@ -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. diff --git a/src/sage/structure/parent.pyx b/src/sage/structure/parent.pyx index cd0db7ac709..1dd2ae070ca 100644 --- a/src/sage/structure/parent.pyx +++ b/src/sage/structure/parent.pyx @@ -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): """