Python's simplicity philosophy

Andrew Dalke adalke at
Sat Nov 15 00:06:02 CET 2003

Alex Martelli:
> "added"?  'max' worked that way since well before I met Python.  But
> to be consistent with your other arguments, no doubt you'd argue for
> a .sort() followed by [-1] as "more general" than max...

Even better (tongue-in-cheek) would be a function to get the
t largest (or s largest to t largest) without necessarily comparing
between elements whose values are guaranteed out of range

Just looked through Knuth for that.  There are various ways
listed, but no neat name to use for that function.  :)
Look under 'select k largest' and 'select kth largest'.  Most
of the hits are in the exercises.  First one is for Hoare, and
there's a reference to Dodgson (Carroll) and lawn tennis.

                    dalke at

More information about the Python-list mailing list