add functions for task on functional programming#9
Open
ipsemenov wants to merge 1 commit into
Open
Conversation
krglkvrmn
reviewed
Dec 11, 2021
krglkvrmn
left a comment
There was a problem hiding this comment.
В целом хорошо, но возникла путаница с назначением функций, комментарии ниже
|
|
||
| funcs = args[:-1] | ||
| lst = args[-1] | ||
| lst = func_chain(*funcs)(lst) |
There was a problem hiding this comment.
Функции нужно было применять к каждому элементу контейнера, а не к контейнеру целиком, она же называется map
| return lst | ||
|
|
||
|
|
||
| def conditional_reduce(func_1, func_2, lst): |
There was a problem hiding this comment.
А эта функция уже должна делать reduce, причём сама. Тут же ты перекладываешь ответственность за это на func_2
Comment on lines
+100
to
+105
| def partial(func, *args, **kwargs): | ||
| def newfunc(*fargs, **fkwargs): | ||
| newkwargs = kwargs.copy() | ||
| newkwargs.update(fkwargs) | ||
| return func(*fargs, **newkwargs) | ||
| return newfunc |
There was a problem hiding this comment.
Можно объявить её отдельно, чтобы избежать очень высокого уровня вложенности
| ''' | ||
| Wrapper around func_chain function. Makes consistent application of functions | ||
| passed into decorator function - func_chain. | ||
| :param args: positional arguments |
There was a problem hiding this comment.
В твоём случае args это 1 аргумент
Suggested change
| :param args: positional arguments | |
| :param args: positional argument |
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.
No description provided.