-
Notifications
You must be signed in to change notification settings - Fork 172
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make sure formula in Sequence is callable #52
Conversation
函数规格 ```python def (x) # 返回第x个
其实就是把 |
这样支持成块的函数(可能没啥用) |
It's a breaking change. You'd better not to do so. |
why? |
cyaron/sequence.py
Outdated
def __get_one(self, i): | ||
if i in self.values: | ||
return self.values[i] | ||
|
||
self.values[i] = self.formula(i, self.__get_one) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you remove this argument here?
cyaron/sequence.py
Outdated
@@ -17,11 +19,12 @@ def __init__(self, formula, initial_values=()): | |||
else: | |||
raise Exception("Initial_values must be either a list/tuple or a dict.") | |||
|
|||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An extra blank line
我删了空行 |
@william-song-shy Here is still a review left. PTAL. |
您能说中文吗? |
我在第 24 行的改动上还有一个 review。你这个改动打破了现有的 API 行为。 |
所以呢? |
好的,我改成这样可以吧。 @moesoha |
@william-song-shy 为什么要放弃第二个参数 |
看下新的吧(保持了 |
@william-song-shy 对于 lamda 保留参数也不影响的话,就不要做这个不必要的判断。 |
大佬觉得该怎样? @laosb |
这里返回函数是用于像斐波那契这种递归定义的数列,所以返回的是 |
我的想法 def f (x)
return f(x-1)+f(x-2) |
|
就当我只加了一句异常和一个工具 |
@william-song-shy 判断lambda基本不需要,以及你把缩进都改了,还有code style也不一致 |
@william-song-shy 算了我来改吧 |
函数规格
@lin714093880