Skip to content

Commit d99d034

Browse files
committed
Return True instead of None to avoid cachefunc being useless
1 parent e7477f8 commit d99d034

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

src/sage/combinat/integer_lists/invlex.pyx

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -860,10 +860,13 @@ If you know what you are doing, you can set check=False to skip this warning."""
860860
861861
OUTPUT:
862862
863-
``None`` if this method finds a proof that there
863+
``True`` if this method finds a proof that there
864864
exists an upper bound on the length. Otherwise a
865865
:exc:`ValueError` is raised.
866866
867+
Note that :func:`cached_method` does not work with methods
868+
returning ``None``, so ``True`` is returned instead.
869+
867870
EXAMPLES::
868871
869872
sage: L = IntegerListsLex(4, max_length=4)
@@ -1002,20 +1005,20 @@ If you know what you are doing, you can set check=False to skip this warning."""
10021005
"""
10031006
# Trivial cases
10041007
if self.max_length < Infinity:
1005-
return
1008+
return True
10061009
if self.max_sum < self.min_sum:
1007-
return
1010+
return True
10081011
if self.min_slope > self.max_slope:
1009-
return
1012+
return True
10101013
if self.max_slope < 0:
1011-
return
1014+
return True
10121015
if self.ceiling.limit() < self.floor.limit():
1013-
return
1016+
return True
10141017
if self.ceiling.limit() == 0:
10151018
# This assumes no trailing zeroes
1016-
return
1019+
return True
10171020
if self.min_slope > 0 and self.ceiling.limit() < Infinity:
1018-
return
1021+
return True
10191022
10201023
# Compute a lower bound on the sum of floor(i) for i=1 to infinity
10211024
if self.floor.limit() > 0 or self.min_slope > 0:
@@ -1028,24 +1031,24 @@ If you know what you are doing, you can set check=False to skip this warning."""
10281031
floor_sum_lower_bound = Infinity
10291032
10301033
if self.max_sum < floor_sum_lower_bound:
1031-
return
1034+
return True
10321035
if self.max_sum == floor_sum_lower_bound and self.max_sum < Infinity:
10331036
# This assumes no trailing zeroes
1034-
return
1037+
return True
10351038
10361039
# Variant on ceiling.limit() ==0 where we actually discover that the ceiling limit is 0
10371040
if ( self.max_slope == 0 and
10381041
(self.max_sum < Infinity or
10391042
(self.ceiling.limit_start() < Infinity and
10401043
any(self.ceiling(i) == 0 for i in range(self.ceiling.limit_start()+1)))
10411044
) ):
1042-
return
1045+
return True
10431046
10441047
limit_start = max(self.ceiling.limit_start(), self.floor.limit_start())
10451048
if limit_start < Infinity:
10461049
for i in range(limit_start+1):
10471050
if self.ceiling(i) < self.floor(i):
1048-
return
1051+
return True
10491052
10501053
raise ValueError("could not prove that the specified constraints yield a finite set")
10511054

0 commit comments

Comments
 (0)