473,804 Members | 3,447 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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:sw****** *@gmail.com]
Sent: Tuesday, March 22, 2005 1:25 PM
To: Leeds, Mark
Cc: py*********@pyt hon.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(l ambda 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
Jul 18 '05 #1
0 1215

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1412
by: Josiah Carlson | last post by:
QOTW: "Python, the language that wraps tightly around a problem and swallows it whole." -- Raymond Hettinger Because it is so important, this link is re-posted for the future (originally appeared in the December 15 Python-Url! posting by Cameron Laird): Martin Bless summarizes in an extremely valuable post what you need to know to generate Python-related executable binaries targeted for Windows*.
0
1173
by: Josiah Carlson | last post by:
QOTW: "XML with elementtree is what makes me never have think about XML again." -- Istvan Albert "'Plays well with others' was a strong motivator for Python's design, and that often means playing by others' rules." -- Tim Peters Type mutability, and why some types are immutable. This has been discussed before, and should be a FAQ topic (if it isn't already):...
0
1120
by: Simon Brunning | last post by:
QOTW: "Python is more concerned with making it easy to write good programs than difficult to write bad ones." - Steve Holden "Scientists build so that they can learn. Programmers and engineers learn so that they can build." - Magnus Lycka "It happens that old Java programmers make one module per class when they start using Python. That's more or less equivalent of never using more than 8.3 characters in filenames in modern operating...
0
291
by: Diez B. Roggisch | last post by:
QOTW: "If I wanted to write five lines instead of one everywhere in a Python program, I'd use Java." -- Paul Rubin http://groups.google.com/group/comp.lang.python/msg/6fac4f3022acd1fa?hl=de& "i think less buggy code is not the main concern for all." -- km http://groups.google.com/group/comp.lang.python/msg/db5acbd68447ae33?hl=de& Bryan Olson discovers inconsistencies in the slice implementation that lead to a new slicing PEP and a...
1
1224
by: Jack Diederich | last post by:
QOTW: "Regexps are a brittle tool, best tolerated in small doses." - Tim Peters "Simplicity is prerequisite for reliability" - Edsger W. Dijkstra eval(repr(var)) sometimes works for serialization but don't count on it. http://groups.google.com/group/comp.lang.python/browse_thread/thread/71b54c23162ffcd9/ More than you ever wanted to know about the types of regular expression engines and their history.
0
1593
by: Paul Boddie | last post by:
QOTW: "I think you've got the wrong intuition about the balance between the amount of bandwidth and the amount of computation a given numer of dollars would buy. You've hundreds of CPU cycles available per bit transmitted; space enough to stick in even Python." - Thomas Womack (on comp.lang.lisp, earlier this year, so it's not a true QOTW) http://groups.google.com/group/comp.lang.lisp/msg/453239d7b8e0ef72 "I'm a recent, belated convert...
1
1346
by: Gabriel Genelli | last post by:
QOTW: "A java class full of static methods translates to a python module populated with functions in general." - Arnaud Delobelle "Neurons are far more valuable than disk space, screen lines, or CPU cycles." - Ben Finney How do people install Python and libraries in a server without root access? http://groups.google.com/group/comp.lang.python/browse_thread/thread/9422609e56653ccd
0
1093
by: Gabriel Genellina | last post by:
QOTW: "However, inspection of a vast corpus of code might lead one to believe that any commenting capability was completely unnecessary." - Jim B. Wilson "The Python people also piped to say 'everything's just fine here', but then they always do; I really must learn that language." - Tim Bray A variation on a classic problem: 5 Queens control an 8x8 board without attacking themselves...
0
9591
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10594
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10343
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10087
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9166
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5529
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5667
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4306
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3001
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.