lists - append - unique and sorted

Josiah Carlson josiah.carlson at sbcglobal.net
Wed Jun 6 12:35:06 EDT 2007


Neil Cerutti wrote:
> On 2007-06-06, rhXX <rh00667 at gmail.com> wrote:
>> and/or
>>
>> - SORTED - INSERT in the correct place using some criteria?
> 
> Consult the Python Docs about the heapq module.

Heaps (as produced by heapq) are not sorted.  This will not produce 
correct results unless one then pops everything and de-dupes the output.

As Diez has already said, 'use the bisect module' .

  - Josiah



More information about the Python-list mailing list