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 @@ -2376,16 +2376,13 @@ def _check_equal_length(seq_of_seqs):
2376
2376
Ensure that all sequences in seq_of_seqs are the same length.
2377
2377
2378
2378
Since this function is time critical, it does zero error checking.
2379
- Two exceptions can result from calling this function.
2380
- 1. IndexError: seq_of_seqs is not an indexed sequence.
2381
- 2. TypeError: An inner sequence does not support len().
2382
-
2383
- This check is up to O(n) and can be expensive, so use only when necessary.
2379
+ A TypeError will be raised if inner sequence does not support len().
2384
2380
2385
2381
Return True if all sequences are the same length, otherwise False
2386
2382
"""
2387
- L0 = len (seq_of_seqs [0 ])
2388
- for seq in seq_of_seqs :
2383
+ seq_it = iter (seq_of_seqs )
2384
+ L0 = len (next (seq_it ))
2385
+ for seq in seq_it :
2389
2386
if len (seq ) != L0 :
2390
2387
return False
2391
2388
return True
You can’t perform that action at this time.
0 commit comments