Created
November 21, 2017 01:14
-
-
Save allieus/3d97a51335fb1a72dd821888137f1eca to your computer and use it in GitHub Desktop.
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
def myfilter(filter_fn, alter_value): | |
def wrap (fn): | |
def inner(*args): | |
# fn을 호출하는 코드가 없네요. | |
# iterator = list(filter (filter_fn, [*args])) | |
# if [*args] not in iterator: | |
# return alter_value | |
# args 값이 현재 (1, 2, 3, 4, 5) 이죠? | |
# 이 args값으로부터 아래 new_args 를 만드시는 문제입니다. :) | |
new_args = [0, 2, 0, 4, 0] | |
return fn(*new_args) | |
return inner | |
return wrap | |
@myfilter (lambda i: i%2 ==0, 0) | |
def mysum (a,b,c,d,e): | |
return a + b+ c+ d+ e | |
print(mysum (1,2,3,4,5)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment