L
Leeds, Mark
This is a follow up question
To the previous question
About sorting that
I sent for my friend.
-----Original Message-----
From: Tan, Heap Ho
Sent: Tuesday, March 22, 2005 2:06 PM
To: Leeds, Mark
Subject: RE: FW: Python help group
How can you speed it? Does anyone know if pytable can take
non-homogeneous objects type?
-----Original Message-----
From: Leeds, Mark
Sent: Tuesday, March 22, 2005 1:39 PM
To: Tan, Heap Ho
Subject: FW: FW: Python help group
-----Original Message-----
From: Swaroop C H [mailto:[email protected]]
Sent: Tuesday, March 22, 2005 1:25 PM
To: Leeds, Mark
Cc: (e-mail address removed)
Subject: Re: FW: Python help group
... self.name = name
... self.age = age
...
See `help(list.sort)` for details.
To the previous question
About sorting that
I sent for my friend.
-----Original Message-----
From: Tan, Heap Ho
Sent: Tuesday, March 22, 2005 2:06 PM
To: Leeds, Mark
Subject: RE: FW: Python help group
How can you speed it? Does anyone know if pytable can take
non-homogeneous objects type?
-----Original Message-----
From: Leeds, Mark
Sent: Tuesday, March 22, 2005 1:39 PM
To: Tan, Heap Ho
Subject: FW: FW: Python help group
-----Original Message-----
From: Swaroop C H [mailto:[email protected]]
Sent: Tuesday, March 22, 2005 1:25 PM
To: Leeds, Mark
Cc: (e-mail address removed)
Subject: Re: FW: Python help group
... def __init__(self, name, age):I want to do a sort on a list of objects based on a similar attributes in
each object for example time of creation of this object.
... self.name = name
... self.age = age
...
>>>
>>> students = [Student('John', 18), Student('Jill', 17)]
>>> students.sort(lambda x,y: cmp(x.age, y.age))
>>> [student.name for student in students] ['Jill', 'John']
>>>
See `help(list.sort)` for details.