Message116344
> Of course, there are subtle implications of how it will be implemented
Indeed. Ideally, as you mention, the implementation would only use __lt__ (as with sort and bisect). I think that constraint only leaves one reasonable choice: namely, max and min for multiple args would be functionally equivalent to max_list and min_list below:
def min2(x, y):
return y if y < x else x
def max2(x, y):
return x if y < x else y
def min_list(xs):
return reduce(min2, xs)
def max_list(xs):
return reduce(max2, xs) |
|
Date |
User |
Action |
Args |
2010-09-13 19:38:00 | mark.dickinson | set | recipients:
+ mark.dickinson, rhettinger, pitrou, mattheww, jyasskin, docs@python |
2010-09-13 19:38:00 | mark.dickinson | set | messageid: <1284406680.29.0.770071846012.issue9802@psf.upfronthosting.co.za> |
2010-09-13 19:37:57 | mark.dickinson | link | issue9802 messages |
2010-09-13 19:37:57 | mark.dickinson | create | |
|