Skip to content

Commit a8698ce

Browse files
committed
add comments
1 parent 5c569dd commit a8698ce

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

unpythonic/mathseq.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,7 @@ def analyze(*spec): # raw spec (part before '...' if any) --> description
314314
if almosteq(p1, p2): # a0, a0**p, (a0**p)**p, ... [a0, **p]
315315
p = (p1 + p2) / 2
316316
return ("power", a0, p)
317+
# Most unrecognized sequences trigger this case.
317318
raise SyntaxError("Specification did not match any supported formula: '{}'".format(origspec))
318319
else: # more elements are optional but must be consistent
319320
data = [analyze(*triplet) for triplet in zip(spec, spec[1:], spec[2:])]
@@ -322,6 +323,8 @@ def isconst(*xs):
322323
first, *rest = xs
323324
return all(almosteq(x, first) for x in rest)
324325
if not isconst(seqtypes) or not isconst(ks):
326+
# This case is only triggered if all triplets specify some
327+
# recognized sequence, but the specifications don't agree.
325328
raise SyntaxError("Inconsistent specification '{}'".format(origspec))
326329
return data[0]
327330

0 commit comments

Comments
 (0)