Skip to content

Commit

Permalink
Merge pull request #744 from pochmann/patch-5
Browse files Browse the repository at this point in the history
Simplify `_zip_equal`
  • Loading branch information
bbayles committed Aug 1, 2023
2 parents 3e1b301 + 5fd6c67 commit ff2a90f
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions more_itertools/recipes.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,13 +347,9 @@ def _zip_equal(*iterables):
for i, it in enumerate(iterables[1:], 1):
size = len(it)
if size != first_size:
break
else:
# If we didn't break out, we can use the built-in zip.
return zip(*iterables)

# If we did break out, there was a mismatch.
raise UnequalIterablesError(details=(first_size, i, size))
raise UnequalIterablesError(details=(first_size, i, size))
# All sizes are equal, we can use the built-in zip.
return zip(*iterables)
# If any one of the iterables didn't have a length, start reading
# them until one runs out.
except TypeError:
Expand Down

0 comments on commit ff2a90f

Please sign in to comment.