> 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 word.) --Guido van Rossum (home page: http://dinsdale.python.org/~guido/)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4