File tree 1 file changed +4
-7
lines changed
1 file changed +4
-7
lines changed Original file line number Diff line number Diff line change @@ -2336,16 +2336,13 @@ def _check_equal_length(seq_of_seqs):
2336
2336
Ensure that all sequences in seq_of_seqs are the same length.
2337
2337
2338
2338
Since this function is time critical, it does zero error checking.
2339
- Two exceptions can result from calling this function.
2340
- 1. IndexError: seq_of_seqs is not an indexed sequence.
2341
- 2. TypeError: An inner sequence does not support len().
2342
-
2343
- This check is up to O(n) and can be expensive, so use only when necessary.
2339
+ A TypeError will be raised if inner sequence does not support len().
2344
2340
2345
2341
Return True if all sequences are the same length, otherwise False
2346
2342
"""
2347
- L0 = len (seq_of_seqs [0 ])
2348
- for seq in seq_of_seqs :
2343
+ seq_it = iter (seq_of_seqs )
2344
+ L0 = len (next (seq_it ))
2345
+ for seq in seq_it :
2349
2346
if len (seq ) != L0 :
2350
2347
return False
2351
2348
return True
You can’t perform that action at this time.
0 commit comments