What's b.index(x) do? I'm guessing the for a list Delta = ["a,"b","c"], you get
Delta.index("b") 1 Am I right? On Apr 1, 2005 1:16 PM, py <[EMAIL PROTECTED]> wrote: > > > An alternative way of doing this (if you have python 2.4): > > >>> ppl = ['john', 'mary', 'lary', 'jane'] > >>> age = [15, 30, 23, 25] > >>> height= [160, 165, 178, 170] > > >>> sortby = lambda a, b: [a[b.index(x)] for x in sorted(b)] > >>> sortby(ppl, age) > ['john', 'lary', 'jane', 'mary'] > >>> sortby(ppl, height) > ['john', 'mary', 'jane', 'lary'] > > >>> age # age is not changed > [15, 30, 23, 25] > > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > > > -- 'There is only one basic human right, and that is to do as you damn well please. And with it comes the only basic human duty, to take the consequences. _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor