On Sun, 26 Mar 2006 10:34:16 -0700, Steven Bethard wrote:
> What's the original?
def minimum(cmp, lst):
"""minimum(cmp, lst)
Returns the minimal element in non-empty list LST with elements
compared via CMP() which should return values with the same semantics
as Python's cmp(). If there are several minimal elements, the last
one is returned.
"""
if not lst:
raise ValueError, 'empty list'
minval = lst[0]
for i in xrange(1, len(lst)):
v = lst[i]
if cmp(minval, v) > 0:
minval = v
return minval
This is from Google's "goopy" package.
http://goog-goopy.sourceforge.net/
--
Steve R. Hastings "Vita est"
[EMAIL PROTECTED] http://www.blarg.net/~steveha
--
http://mail.python.org/mailman/listinfo/python-list