Make sure formula in Sequence is callable#52
Merged
moesoha merged 7 commits intoluogu-dev:masterfrom Feb 15, 2019
william-song-shy:master
Merged
Make sure formula in Sequence is callable#52moesoha merged 7 commits intoluogu-dev:masterfrom william-song-shy:master
moesoha merged 7 commits intoluogu-dev:masterfrom
william-song-shy:master
Conversation
函数规格 ```python def (x) # 返回第x个
Contributor
Author
|
其实就是把 |
Contributor
Author
|
这样支持成块的函数(可能没啥用) |
Member
|
It's a breaking change. You'd better not to do so. |
Contributor
Author
why? |
moesoha
reviewed
Feb 14, 2019
| if i in self.values: | ||
| return self.values[i] | ||
|
|
||
| self.values[i] = self.formula(i, self.__get_one) |
Member
There was a problem hiding this comment.
Why do you remove this argument here?
moesoha
requested changes
Feb 14, 2019
cyaron/sequence.py
Outdated
| else: | ||
| raise Exception("Initial_values must be either a list/tuple or a dict.") | ||
|
|
||
|
|
Contributor
Author
|
我删了空行 |
Member
|
@william-song-shy Here is still a review left. PTAL. |
Contributor
Author
|
您能说中文吗? |
Member
|
我在第 24 行的改动上还有一个 review。你这个改动打破了现有的 API 行为。 |
Contributor
Author
|
所以呢? |
Contributor
Author
|
好的,我改成这样可以吧。 @moesoha |
Member
|
@william-song-shy 为什么要放弃第二个参数 |
Contributor
Author
|
看下新的吧(保持了 |
|
@william-song-shy 对于 lamda 保留参数也不影响的话,就不要做这个不必要的判断。 |
Contributor
Author
|
大佬觉得该怎样? @laosb |
Member
|
这里返回函数是用于像斐波那契这种递归定义的数列,所以返回的是 |
Contributor
Author
|
我的想法 def f (x)
return f(x-1)+f(x-2) |
Member
|
|
Contributor
Author
|
就当我只加了一句异常和一个工具 |
Member
|
@william-song-shy 判断lambda基本不需要,以及你把缩进都改了,还有code style也不一致 |
Member
|
@william-song-shy 算了我来改吧 |
moesoha
approved these changes
Feb 15, 2019
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
函数规格
@lin714093880