[Biopython-dev] test_AlignIO to python 3

Tiago Antão tiagoantao at gmail.com
Mon Jul 5 12:05:26 UTC 2010


2010/7/5 Peter Cock <p.j.a.cock at googlemail.com>:
> For the codon sort case, the old code effectively did two sorts
> (one by length with a tie breaker). If you can write some unit tests
> to check we don't alter the behaviour, the clean fix is nicer.


>>> a=[(1,2),(1,1),(2,1),(1,0)]
>>> a.sort(key=lambda x:(x[0],x[1]))
>>> a
[(1, 0), (1, 1), (1, 2), (2, 1)]


Multi-level sorting is possible ;)
thus
possible.sort(key=lambda x:(len(self.ambiguous_protein[x]), x))



More information about the Biopython-dev mailing list