Re: lists - append - unique and sorted

2007-06-12 Thread rhXX
On Jun 8, 12:17 am, "Delaney, Timothy (Tim)" <[EMAIL PROTECTED]> wrote: > Terry Reedy wrote: > > "Dan Bishop" <[EMAIL PROTECTED]> wrote in message > >news:[EMAIL PROTECTED] > >> If you don't need the list to be sorted until you're done building > >> it, you can just use: > > >> lst = sorted(set(lst

RE: lists - append - unique and sorted

2007-06-07 Thread Delaney, Timothy (Tim)
Terry Reedy wrote: > "Dan Bishop" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> If you don't need the list to be sorted until you're done building >> it, you can just use: >> >> lst = sorted(set(lst)) > > ?? looks same as > lst.sort() You missed that the OP wants only unique

Re: lists - append - unique and sorted

2007-06-07 Thread Terry Reedy
"Dan Bishop" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | If you don't need the list to be sorted until you're done building it, | you can just use: | | lst = sorted(set(lst)) ?? looks same as lst.sort() -- http://mail.python.org/mailman/listinfo/python-list

Re: lists - append - unique and sorted

2007-06-06 Thread Dan Bishop
On Jun 6, 10:26 am, rhXX <[EMAIL PROTECTED]> wrote: > hi, > > can i append a item to a list using criterias: > > - UNIQUE - if there already exist don't append > > and/or > > - SORTED - INSERT in the correct place using some criteria? > > tks in advance If you don't need the list to be sorted unti

Re: lists - append - unique and sorted

2007-06-06 Thread Steve Howell
--- Neil Cerutti <[EMAIL PROTECTED]> wrote: > i agree that using bisect and inserting manually > clearly meets > the stated requirements, while there isn't enough > information to > know if a heapq will meet his requirements. > > Thanks for the correction. > If the OP is still reading, don't di

Re: lists - append - unique and sorted

2007-06-06 Thread Neil Cerutti
On 2007-06-06, Josiah Carlson <[EMAIL PROTECTED]> wrote: > Neil Cerutti wrote: >> On 2007-06-06, rhXX <[EMAIL PROTECTED]> 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

Re: lists - append - unique and sorted

2007-06-06 Thread rhXX
On Jun 6, 6:35 pm, Josiah Carlson <[EMAIL PROTECTED]> wrote: ok, tks to all for ur help and comments!!! > Neil Cerutti wrote: > > On 2007-06-06, rhXX <[EMAIL PROTECTED]> wrote: > >> and/or > > >> - SORTED - INSERT in the correct place using some criteria? > > > Consult the Python Docs about the he

Re: lists - append - unique and sorted

2007-06-06 Thread Josiah Carlson
Neil Cerutti wrote: > On 2007-06-06, rhXX <[EMAIL PROTECTED]> 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

Re: lists - append - unique and sorted

2007-06-06 Thread Neil Cerutti
On 2007-06-06, rhXX <[EMAIL PROTECTED]> wrote: > hi, > > can i append a item to a list using criterias: > > - UNIQUE - if there already exist don't append Consult the Python Docs about sets. > and/or > > - SORTED - INSERT in the correct place using some criteria? Consult the Python Docs about th

Re: lists - append - unique and sorted

2007-06-06 Thread Diez B. Roggisch
rhXX wrote: > hi, > > can i append a item to a list using criterias: > > - UNIQUE - if there already exist don't append > - SORTED - INSERT in the correct place using some criteria? Both can be accomplished using the bisect-module. It will give you the leftmost/rightmost insertion point for

lists - append - unique and sorted

2007-06-06 Thread rhXX
hi, can i append a item to a list using criterias: - UNIQUE - if there already exist don't append and/or - SORTED - INSERT in the correct place using some criteria? tks in advance -- http://mail.python.org/mailman/listinfo/python-list