From f2b6ae351eac277e830993bf3fba0031f7220da7 Mon Sep 17 00:00:00 2001 From: Bakhtiyor Ruziev <32102033+theruziev@users.noreply.github.com> Date: Wed, 25 Sep 2019 15:45:25 +0300 Subject: [PATCH 1/2] Remove redundant map --- snippets/none.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/snippets/none.md b/snippets/none.md index b12512d2b..a99ecb388 100644 --- a/snippets/none.md +++ b/snippets/none.md @@ -5,11 +5,11 @@ tags: list,function,intermediate Returns `False` if the provided function returns `True` for at least one element in the list, `True` otherwise. -Use `all()` in combination with `map()` and `fn` to check if `fn` returns `False` for all the elements in the list. +Use `all()` and run `fn` to check if `fn` returns `False` for all the elements in the list. ```py def none(lst, fn=lambda x: x): - return all(map(lambda x: not fn(x), lst)) + return all(not fn(x) for x in lst) ``` ```py From f25ea2a8cb420ea24b12ae85522b33326e42e0a3 Mon Sep 17 00:00:00 2001 From: Angelos Chalaris Date: Wed, 25 Sep 2019 22:15:34 +0300 Subject: [PATCH 2/2] Update none.md --- snippets/none.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snippets/none.md b/snippets/none.md index a99ecb388..f6ec47b4b 100644 --- a/snippets/none.md +++ b/snippets/none.md @@ -5,7 +5,7 @@ tags: list,function,intermediate Returns `False` if the provided function returns `True` for at least one element in the list, `True` otherwise. -Use `all()` and run `fn` to check if `fn` returns `False` for all the elements in the list. +Use `all()` and `fn` to check if `fn` returns `False` for all the elements in the list. ```py def none(lst, fn=lambda x: x):