We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent cb8e15b commit a03127bCopy full SHA for a03127b
src/sage/combinat/posets/posets.py
@@ -1230,6 +1230,21 @@ def unwrap(self, element):
1230
else:
1231
return element.element
1232
1233
+ def __bool__(self) -> bool:
1234
+ r"""
1235
+ Return if ``self`` is empty or not.
1236
+
1237
+ EXAMPLES::
1238
1239
+ sage: P = Poset((divisors(15), attrcall("divides")), facade=True)
1240
+ sage: bool(P)
1241
+ True
1242
+ sage: P = Poset()
1243
1244
+ False
1245
+ """
1246
+ return bool(self._elements)
1247
1248
def __contains__(self, x) -> bool:
1249
r"""
1250
Return ``True`` if ``x`` is an element of the poset.
0 commit comments