summaryrefslogtreecommitdiffstats
path: root/Modules/itertoolsmodule.c
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2003-06-18 19:25:37 (GMT)
committerRaymond Hettinger <python@rcn.com>2003-06-18 19:25:37 (GMT)
commitbefa37dd05050ecce9637d81ebe9d8d74688129c (patch)
tree904725503d82dda010c10fecb8bb6327d98c9c4d /Modules/itertoolsmodule.c
parent3a8fbe7eeca4cc8cb944c8120690e54a6c775747 (diff)
downloadcpython-befa37dd05050ecce9637d81ebe9d8d74688129c.zip
cpython-befa37dd05050ecce9637d81ebe9d8d74688129c.tar.gz
cpython-befa37dd05050ecce9637d81ebe9d8d74688129c.tar.bz2
Minor updates:
* Updated comment on design of imap() * Added untraversed object in izip() structure * Replaced the pairwise() example with a more general window() example
Diffstat (limited to 'Modules/itertoolsmodule.c')
-rw-r--r--Modules/itertoolsmodule.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/Modules/itertoolsmodule.c b/Modules/itertoolsmodule.c
index 0a20c1b..fae4511 100644
--- a/Modules/itertoolsmodule.c
+++ b/Modules/itertoolsmodule.c
@@ -882,7 +882,7 @@ the following reasons:
None.
4) If a need does arise, it can be met by __builtins__.map() or by
- writing a generator.
+ writing: chain(iterable, repeat(None)).
5) Similar toolsets in Haskell and SML do not have automatic None fill-in.
*/
@@ -1574,8 +1574,18 @@ izip_dealloc(izipobject *lz)
static int
izip_traverse(izipobject *lz, visitproc visit, void *arg)
{
- if (lz->ittuple)
- return visit(lz->ittuple, arg);
+ int err;
+
+ if (lz->ittuple) {
+ err = visit(lz->ittuple, arg);
+ if (err)
+ return err;
+ }
+ if (lz->result) {
+ err = visit(lz->result, arg);
+ if (err)
+ return err;
+ }
return 0;
}