From a8055937f3e3fdf2495e35fa7bdff6449e19375a Mon Sep 17 00:00:00 2001 From: Aric Coady Date: Mon, 31 Oct 2016 19:25:28 -0700 Subject: [PATCH] Simplified cons. --- toolz/itertoolz.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/toolz/itertoolz.py b/toolz/itertoolz.py index 76353e94..20b75bb2 100644 --- a/toolz/itertoolz.py +++ b/toolz/itertoolz.py @@ -511,9 +511,7 @@ def cons(el, seq): >>> list(cons(1, [2, 3])) [1, 2, 3] """ - yield el - for s in seq: - yield s + return itertools.chain([el], seq) def interpose(el, seq):