Like builtin `zip`, but checks that iterables have same length.
(*iterables)
| 195 | |
| 196 | |
| 197 | def safe_zip(*iterables): |
| 198 | """Like builtin `zip`, but checks that iterables have same length.""" |
| 199 | n = len(iterables[0]) |
| 200 | for iterable in iterables: |
| 201 | if len(iterable) != n: |
| 202 | raise ValueError("Zipped items must all have same length.") |
| 203 | return zip(*iterables) |
| 204 | |
| 205 | |
| 206 | def whitespace_align_seqs(seqs): |
no outgoing calls
no test coverage detected
searching dependent graphs…