Downloads
Python
Home
›
The Python Tourist #3: Forgetting how cmp() works ... no problem!
March 12, 2007 - 1:06pm — Tom (not verified)
return cmp(self.state,
return cmp(self.state, other.state,) or
cmp(self.last,other.last) or
cmp(self.first,other.first)
could be written as
return cmp((self.state, self.last, self.first),
(other.state, other.last, other.first))
without relying on "or trickery".
Reply
Your name:
E-mail:
The content of this field is kept private and will not be shown publicly.
Homepage:
Subject:
Comment:
*
Input format
Filtered HTML
Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
Lines and paragraphs break automatically.
WikklyText, Restricted Mode
Write content in
WikklyText
format -
Restricted (Safe) Mode
.
For detailed help, see the
WikklyText Reference
More information about formatting options
Popular content
All time:
All About Python and Unicode
The Python Tourist #4: None, empty, and nothing.
Building Python extensions for Windows with only free tools
The Python Tourist #5: Replacing sys.version_info with pyconfig
MYOML #6: Metainfo, notes, warnings, and more HTML tags
Last viewed:
Refreshed: "The Python Tourist"
MYOML #3: Building Blocks
TiddlyWiki - a wiki without a server - WOW!
Syncing jEdit settings between machines
All About Python and Unicode
User login
Username:
*
Password:
*
Request new password
return cmp(self.state,
cmp(self.last,other.last) or
cmp(self.first,other.first)
(other.state, other.last, other.first))