[Python-ideas] "Exposing" `__min__` and `__max__`

Serhiy Storchaka storchaka at gmail.com
Wed Jun 20 00:05:19 EDT 2018

19.06.18 22:18, James Edwards пише:
> I've only recently looked for these special methods, so that in and of 
> itself may be the reason these methods aren't exposed, but I could think 
> of objects that may wish to implement __min__ and __max__ themselves, 
> for efficiency.

There are two questions.

1. What to do with additional min() and max() arguments: key and default.

2. Is the need of this feature large enough? Will the benefit for 
special cases exceed the drawback of increasing implementation 
complexity and slowing down common cases?

If supporting of arguments key and default are not needed for you, you 
can implement your own functions and use them instead of min() and max().

More information about the Python-ideas mailing list