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'
"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
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]&
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
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
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
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