What's more pythonic?

Paul Rubin http
Wed Sep 13 00:14:13 EDT 2006


Dan Stromberg <strombrg at dcs.nac.uci.edu> writes:
> 	def __cmp__(self, other):
> 		if self.a < other.a:
> 			return -1
> 		elif self.a > other.a:
> 			return 1
> 		else:
> 			return 0

I think I'd have written

           return cmp(self.a, other.a)




More information about the Python-list mailing list