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.
MYOML #6: Metainfo, notes, warnings, and more HTML tags
Building Python extensions for Windows with only free tools
The Python Tourist #2: Taking Exception
Last viewed:
Building Python extensions for Windows with only free tools
Having Drupal live in a subdirectory
All About Python and Unicode
WikklyText 0.99.16 - Released
MYOML #6: Metainfo, notes, warnings, and more HTML tags
User login
Username:
*
Password:
*
Create new account
Request new password
return cmp(self.state,
cmp(self.last,other.last) or
cmp(self.first,other.first)
(other.state, other.last, other.first))