[Python-Dev] request for minor enhancement

Guido van Rossum guido@beopen.com
Fri, 14 Jul 2000 10:58:28 -0500

> 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?

You seem to propose two independent things.

1. in-fix min and max: you want to write "x min y" instead min(x, y).
Why?  It's not a notation I'm familiar with.  Plus it's incompatible,
since min would have to be a reserved word and it would break all
existing code using min().

2. __min__ and __max__ to override the semantics.  Sure, this can be
added regardless of (1).  But do you want to override min(a, b) or
min(sequence)?  Note that min() and max() are variadic functions --
you can write min(a,b,c,d,e) which is the same as min([a,b,c,d,e]).

3. min= and max=?  Ah, I see, like += and -=.  Since I don't see much
hope for (1) this is irrelevant.  (But it's a good proposal for a
generic syntax for other operators that are spelled with a reserved

--Guido van Rossum (home page: http://dinsdale.python.org/~guido/)