biocore/scikit-bio — pull request #694 by laurentluce (2014-10-05 18:39:11+00:00)
Title: Make equal sequence length an invariant of Alignment.

Issue #670.

Modified the Alignment constructor to verify that all sequences have the same length. If not, raise an exception.

Updated unit tests.

I believe the performance impact is small because the length of a list object in Python is an attribute of the object. Doing len(a) returns the attribute's value:

In [21]: short_list = [1, 2]

In [22]: long_list = [1, 2, 3, 4, 5, 6, 7, 8]

In [23]: %timeit len(short_list)
10000000 loops, best of 3: 56.2 ns per loop

In [24]: %timeit len(long_list)
10000000 loops, best of 3: 56.6 ns per loop