Sorting Countries by Region

Alan algotrhythm at gmail.com
Fri Nov 16 22:15:39 CET 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