Re: FW: Python help group
I would recommend looking into sorting like objects with the __getitem__ method. http://groups-beta.google.com/group/comp.lang.python/browse_thread/thread/b2d0580792b94a7/a707054ec3302a6e has a lively discussion on this topic. Search google for "__getitem__" and "sort" for more information. Leeds, Mark wrote: Can someone help me with below ? It’s not my question but I will forward any answers to my friend who I am sending this for. Mark -Original Message- From: Tan, Heap Ho Sent: Tuesday, March 22, 2005 1:11 PM To: Leeds, Mark Subject: Python help group 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. Is there a simple way to do this? Thank -Original Message- From: Leeds, Mark Sent: Monday, March 21, 2005 5:35 PM To: Tan, Heap Ho Cc: Leeds, Mark Subject: crontab -- __ gabriel.cooper@mediapulse.com internet developer 865.675.4455 x32 800.380.4514 www.mediapulse.com __ -- http://mail.python.org/mailman/listinfo/python-list
FW: FW: Python help group
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: python-list@python.org Subject: Re: FW: Python help group On Tue, 22 Mar 2005 13:15:15 -0500, Leeds, Mark wrote: > 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. >>> >>> class Student: ... def __init__(self, name, age): ... 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. -- Swaroop C H Blog: http://www.swaroopch.info Book: http://www.byteofpython.info -- http://mail.python.org/mailman/listinfo/python-list
Re: FW: Python help group
On Tue, 22 Mar 2005 13:15:15 -0500, Leeds, Mark wrote: > 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. >>> >>> class Student: ... def __init__(self, name, age): ... 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. -- Swaroop C H Blog: http://www.swaroopch.info Book: http://www.byteofpython.info -- http://mail.python.org/mailman/listinfo/python-list
FW: Python help group
Can someone help me with below ? It’s not my question but I will forward any answers to my friend who I am sending this for. Mark -Original Message- From: Tan, Heap Ho Sent: Tuesday, March 22, 2005 1:11 PM To: Leeds, Mark Subject: Python help group 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. Is there a simple way to do this? Thank -Original Message- From: Leeds, Mark Sent: Monday, March 21, 2005 5:35 PM To: Tan, Heap Ho Cc: Leeds, Mark Subject: crontab -- http://mail.python.org/mailman/listinfo/python-list