]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/blobdiff - src/allmydata/util/sixutil.py
Straw-man Python 3 support.
[tahoe-lafs/tahoe-lafs.git] / src / allmydata / util / sixutil.py
diff --git a/src/allmydata/util/sixutil.py b/src/allmydata/util/sixutil.py
new file mode 100644 (file)
index 0000000..a86a4c2
--- /dev/null
@@ -0,0 +1,8 @@
+
+def map(f, xs, ys=None):
+    if ys is None:
+        return [f(x) for x in xs]
+    else:
+        if len(xs) != len(ys):
+            raise AssertionError("iterators must be the same length")
+        return [f(x, y) for (x, y) in zip(xs, ys)]
\ No newline at end of file