Multiple "cmp"s chained one after another

Volker Grabsch volker_grabsch at v.notjusthosting.com
Sat May 14 14:40:40 EDT 2005


Steven Bethard wrote:
> Robert Kern wrote:
>      def mykey(d):
>          return (d.month, d.day)
> 
> The point here is that rather than chaining cmp() calls with ors, you 
> should just use a tuple -- the standard comparison order in tuples is 
> exactly what you're looking for.

That's an excellent idea! Thanks a lot. I really didn't think of the "key="
argument.


Greets,

-- 
Volker Grabsch
---<<(())>>---
\frac{\left|\vartheta_0\times\{\ell,\kappa\in\Re\}\right|}{\sqrt
[G]{-\Gamma(\alpha)\cdot\mathcal{B}^{\left[\oint\!c_\hbar\right]}}}



More information about the Python-list mailing list