Skip to content

Commit fe4bfe8

Browse files
william-song-shymoesoha
authored andcommitted
Make sure formula in Sequence is callable (#52)
* 将序列的函数改为自定义函数 函数规格 ```python def (x) # 返回第x个 * Update sequence.py * Update utils.py * Update sequence.py * Update sequence.py * fix code style and indent, remove useless line. * remove extra spaces
1 parent 48d88e6 commit fe4bfe8

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

cyaron/sequence.py

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ def __init__(self, formula, initial_values=()):
99
Create a sequence object.
1010
int formula(int, function) -> the formula function ...
1111
"""
12+
if not callable(formula):
13+
raise Exception("formula must be a function")
1214
self.formula = formula
1315
if list_like(initial_values):
1416
self.values = dict(enumerate(initial_values))

0 commit comments

Comments
 (0)