Sorting Countries by Region
Alan
algotrhythm at gmail.com
Fri Nov 16 16:15:39 EST 2007
On Nov 16, 8:28 pm, martyw <wit... at kpnplanet.nl> wrote:
>
> i would create a class to capture country information, e.g.
<snip>
What is the advantage of this:
> def __cmp__(self, other):
> if self.name < other.name:
> return -1
> elif self.name > other.name:
> return 1
> else:
> return 0
>
over
def __cmp__(self,other):
return cmp(self.name,other.name)
?
--
Alan
More information about the Python-list
mailing list