Re: reordering elements of a list

2006-06-05 Thread greenflame
Thanks all for your help! -- http://mail.python.org/mailman/listinfo/python-list

Re: reordering elements of a list

2006-06-04 Thread Roberto Bonvallet
greenflame <[EMAIL PROTECTED]>: > Roberto: I do not understand the first half of the last line of your > code. [mainlist[i - 1] for i in orderinglist] is a list made with the elements of orderinglist, but instead of taking the actual value i from the list, the value that is taken is mainlist[i - 1

Re: reordering elements of a list

2006-06-03 Thread Robert Kern
greenflame wrote: > Thank you all for your replies. The only thing is I do not understand > how the code is working. The following are more particular questions. Actually, these are statements, not questions. But anyways: > Travis: Iam sorry, but I do not know what list comprehension is. > Robert

Re: reordering elements of a list

2006-06-03 Thread greenflame
Thank you all for your replies. The only thing is I do not understand how the code is working. The following are more particular questions. Travis: Iam sorry, but I do not know what list comprehension is. Roberto: I do not understand the first half of the last line of your code. Also thank you for

Re: reordering elements of a list

2006-06-03 Thread Christoph Zwerschke
greenflame wrote: > Suppose the main list is: mainlist = list('qwertyuiop') > Suppose the ordering list is: orderinglist = [3, 4, 2, 1] > > Then I am looking for a function that will take mainlist and > orderinglist as arguments and return the following list: > > ['e', 'r', 'w', 'q', 't', 'y', 'u

Re: reordering elements of a list

2006-06-03 Thread Roberto Bonvallet
3 Jun 2006 17:46:49 -0700, greenflame <[EMAIL PROTECTED]>: > Suppose the main list is: mainlist = list('qwertyuiop') > > Suppose the ordering list is: orderinglist = [3, 4, 2, 1] > > Then I am looking for a function that will take mainlist and > orderinglist as arguments and return the following li

Re: reordering elements of a list

2006-06-03 Thread Travis E. Oliphant
greenflame wrote: > I am trying to reorder elements of a list and I am stuck as to what > might be the best way to approach this. I have a (main) list of > elements and another (ordering) list (which is may shorter, but not > longer than the main list) which contains the order in which I want the

reordering elements of a list

2006-06-03 Thread greenflame
I am trying to reorder elements of a list and I am stuck as to what might be the best way to approach this. I have a (main) list of elements and another (ordering) list (which is may shorter, but not longer than the main list) which contains the order in which I want the elements of the main list