[Python-Dev] request for minor enhancement

Moshe Zadka Moshe Zadka <moshez@math.huji.ac.il>
Fri, 14 Jul 2000 18:50:55 +0300 (IDT)

On Fri, 14 Jul 2000, Greg Wilson wrote:

> I would like 'min' and 'max' to be in-fix binary operators, with '__min__'
> and '__max__' as the associated overloadable method names, and 'min=' and
> 'max=' as the in-place forms.  I find myself re-defining them in almost
> every module I write, and believe that their semantics and implementation
> would be unproblematic?

I'm -1 on that. I'm a mathematician by schooling, and I must say


reads much more naturally to me then

1 max 2

And "max=" just looks.....

i max= 5? Come on, isn't

i = max(i, 5)

much more readable?

Re: overloading: it is useful only for lattices, as any linear order can
just use the definition 

max(i,j) == k iff (i==k or j==k) and i<=k and j<=k

Until Python recognizes the fact that not everything is linearly ordered 
(AKA, rich comparisons, which should be done as a PEP really), it would
be futile to deal with lattices.
Moshe Zadka <moshez@math.huji.ac.il>
There is no GOD but Python, and HTTP is its prophet.