Skip to content

Commit 64cae73

Browse files
committed
little detail
1 parent 63ee91e commit 64cae73

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

src/sage/combinat/set_partition_ordered.py

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -250,8 +250,9 @@ def _hash_(self):
250250

251251
def base_set(self):
252252
"""
253-
Return the base set of ``self``, which is the union of all parts
254-
of ``self``.
253+
Return the base set of ``self``.
254+
255+
This is the union of all parts of ``self``.
255256
256257
EXAMPLES::
257258
@@ -276,8 +277,9 @@ def base_set(self):
276277

277278
def base_set_cardinality(self):
278279
"""
279-
Return the cardinality of the base set of ``self``, which is the sum
280-
of the sizes of the parts of ``self``.
280+
Return the cardinality of the base set of ``self``.
281+
282+
This is the sum of the sizes of the parts of ``self``.
281283
282284
This is also known as the *size* (sometimes the *weight*) of
283285
an ordered set partition.
@@ -288,8 +290,17 @@ def base_set_cardinality(self):
288290
4
289291
sage: OrderedSetPartition([[1,2,3,4]]).base_set_cardinality()
290292
4
293+
294+
TESTS::
295+
296+
sage: S = OrderedSetPartitions()
297+
sage: S([[1,4],[3],[2]]).base_set_cardinality()
298+
4
291299
"""
292-
return len(parent(self)._set)
300+
try:
301+
return len(parent(self)._set)
302+
except AttributeError: # in OrderedSetPartitions_all
303+
return sum(len(part) for part in self)
293304

294305
size = base_set_cardinality
295306

0 commit comments

Comments
 (0)