Sorting Countries by Region

martyw nomail at noserve
Mon Nov 19 13:32:20 EST 2007


nothing, Alan wrote:
> 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
yours is better!



More information about the Python-list mailing list