From 4aae49b0d54e7664c7434d900b4629ffad9793e8 Mon Sep 17 00:00:00 2001 From: Matt Craighead Date: Fri, 28 Oct 2011 00:53:15 -0700 Subject: [PATCH] zip() now uses tuples rather than lists --- backend.cpp | 8 ++++---- tests/builtins.py | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/backend.cpp b/backend.cpp index 7203e05..2a2c062 100644 --- a/backend.cpp +++ b/backend.cpp @@ -1338,10 +1338,10 @@ public: list *plist = new(allocator) list(); for (int_t i = 0; i < list1->len(); i++) { - list *pair = new(allocator) list(); - pair->append(list1->__getitem__(i)); - pair->append(list2->__getitem__(i)); - plist->append(pair); + node_list pair; + pair.push_back(list1->__getitem__(i)); + pair.push_back(list2->__getitem__(i)); + plist->append(new(allocator) tuple(pair)); } return plist; diff --git a/tests/builtins.py b/tests/builtins.py index b65264d..5f487cf 100644 --- a/tests/builtins.py +++ b/tests/builtins.py @@ -40,3 +40,5 @@ for x in [[], range(1), range(5)]: for x in [0, 'a', []]: print(str(x)) + +print(list(zip([1, 2], [3, 4]))) -- 2.11.4.GIT