Re: Sorting troubles

2007-05-14 Thread seyensubs
On May 15, 5:35 am, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Mon, 14 May 2007 09:49:56 -0700, Thomas Nelson wrote: > > The thing is that [x for x in List[1:]...] is a brand new list created > > by iterating over the old one. > > How about: > > qSortHelp(List): > > newlist = qSort(List) >

Re: Sorting troubles

2007-05-14 Thread seyensubs
I see. I figured that list comprehensions made another list(duh), but I thought I could relink the object(List) to the new list and keep it once the function ended. Is it possible to pass a reference(to an object.. Like 'List', basically) to a function and change the reference to point to somethin

Sorting troubles

2007-05-14 Thread seyensubs
I have the following implementations of quicksort and insertion sort: def qSort(List): if List == []: return [] return qSort([x for x in List[1:] if x< List[0]]) + List[0:1] + \ qSort([x for x in List[1:] if x>=List[0]]) def insertSort(List): for i in range(1,len(List)):