Returns a list of tuples, where the i-th tuple contains the i-th element from each of the argument sequences or iterables (or default if too short).
(*args, **default)
| 60 | |
| 61 | _zip = zip |
| 62 | def zip(*args, **default): |
| 63 | """ Returns a list of tuples, where the i-th tuple contains the i-th element |
| 64 | from each of the argument sequences or iterables (or default if too short). |
| 65 | """ |
| 66 | args = [list(iterable) for iterable in args] |
| 67 | n = max(map(len, args)) |
| 68 | return _zip(*[i + [default.get("default", None)] * (n-len(i)) for i in args]) |
| 69 | |
| 70 | def unzip(i, iterable): |
| 71 | """ Returns the item at the given index from inside each tuple in the list. |