Is a merge interval function available?

Nobody nobody at nowhere.com
Thu Feb 11 20:37:59 EST 2010


On Wed, 10 Feb 2010 23:03:29 -0500, Steve Holden wrote:

>>     intervals = sorted(intervals, key = lambda x: x[0])
> 
> Since Python uses lexical sorting and the intervals are lists isn't the
> key specification redundant here?

Yes, but I wanted to make it explicit.

Well, omitting the key= would change the sorting order in the event that
multiple intervals have the same start, but it still won't affect the
result of the function overall.




More information about the Python-list mailing list