On 06/07/2020 10:44, Federico Salerno wrote:
On 05/07/2020 23:55, Rob Cliffe wrote:

I don't think the new function should be restricted to numbers.  There may be uses for strings, or for user-built classes; why restrict it unnecessarily?
If it quacks like supporting __lt__ and __gt__, it's a duck.

I'm not opposed to this, although the semantics of calling it with strings may not be intuitive (does it compare the length? Alphabetic order? What order is respected for CJK or symbols?); on the other hand, we already have such behaviour on min() and max() so adding it to clamp() should reasonably be expected to follow the same logic.

The behaviour for strings should be as per the existing string comparisons.  Anything else would be surprising.
The same goes for objects of any other class that supports the relational operators.
Although using it for e.g. sets would be unusual and come labelled with "consenting adults, use at own risk".
Rob Cliffe