Re: [Tutor] advanced sorting

2007-09-05 Thread Kent Johnson
Alan Gauld wrote: > There is a way to modify sort behaviour in older versions of Python > The docs say: > -- > The sort() method takes an optional argument specifying a > comparison function of two arguments Another way to do this is with the 'Decorate-Sort-Undecorate'

Re: [Tutor] advanced sorting

2007-09-05 Thread Alan Gauld
"chinni" <[EMAIL PROTECTED]> wrote > i am using a macpro version(10.4.11) and python version is "2.3.5" Thats the problem, you need Python v2.4 to use the key= feature of sort. There is a way to modify sort behaviour in older versions of Python The docs say: -- The s

[Tutor] advanced sorting

2007-09-04 Thread chinni
Hi, i am using a macpro version(10.4.11) and python version is "2.3.5" Message: 10 Date: Wed, 05 Sep 2007 01:00:44 +0530 From: Noufal Ibrahim <[EMAIL PROTECTED]> Subject: Re: [Tutor] advanced sorting To: [EMAIL PROTECTED] Cc: tutor@python.org Message-ID: <[EMAIL PROTECTED]&

Re: [Tutor] advanced sorting

2007-09-04 Thread Noufal Ibrahim
chinni wrote: > > > In Advance Sorting by giving the keywords to sort the list.But, iam > getting the fallowing errors > > >>> x = ['srikanth', 'kumar', 'muppandam', 'will', 'be', 'a'] > >>> x.sort(key=len) > Traceback (most recent call last): > File "", line 1, in ? > TypeError: sort() tak

Re: [Tutor] advanced sorting

2007-09-04 Thread Eric Brunson
What version of python are you using? chinni wrote: > > > In Advance Sorting by giving the keywords to sort the list.But, iam > getting the fallowing errors > > >>> x = ['srikanth', 'kumar', 'muppandam', 'will', 'be', 'a'] > >>> x.sort(key=len) > Traceback (most recent call last): > File "", l

Re: [Tutor] advanced sorting

2007-09-04 Thread Kent Johnson
chinni wrote: > > > In Advance Sorting by giving the keywords to sort the list.But, iam > getting the fallowing errors > > >>> x = ['srikanth', 'kumar', 'muppandam', 'will', 'be', 'a'] > >>> x.sort(key=len) > Traceback (most recent call last): > File "", line 1, in ? > TypeError: sort() tak

[Tutor] advanced sorting

2007-09-04 Thread chinni
In Advance Sorting by giving the keywords to sort the list.But, iam getting the fallowing errors >>> x = ['srikanth', 'kumar', 'muppandam', 'will', 'be', 'a'] >>> x.sort(key=len) Traceback (most recent call last): File "", line 1, in ? TypeError: sort() takes no keyword arguments >>> x.sort(reve