From b89d142e95f759205622355a5643213720cad228 Mon Sep 17 00:00:00 2001 From: Simon Whalen Date: Fri, 30 Dec 2016 13:11:30 +1300 Subject: [PATCH] Use `and` in hy.core.shadow.comp_op Makes shadow operator behavior match normal (Python) operator behavior when said operators are used in chained comparisons. Resolves #1191 --- hy/core/shadow.hy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hy/core/shadow.hy b/hy/core/shadow.hy index e66d075..5008973 100644 --- a/hy/core/shadow.hy +++ b/hy/core/shadow.hy @@ -65,7 +65,7 @@ "Helper for shadow comparison operators" (if (< (len args) 2) (raise (TypeError "Need at least 2 arguments to compare")) - (reduce operator.and_ + (reduce (lambda [x y] (and x y)) (list-comp (op x y) [(, x y) (zip args (cut args 1))])))) (defn < [&rest args]