On 2020-07-05 14:06, MRAB wrote:
On 2020-07-05 10:09, Federico Salerno wrote:
[snip]
FInally, I'd like to lit another fire: given that `min()` and `max()`
accept an arbitrary amount of arguments, and that the signature that
seems to be preferred for the hypothetical clamp at the moment sees
`value` as the first positional argument, should the function then
accept iterables as values for `minimum` and `maximum`?
Something along the lines of:
clamp(value: Number, minimum: Union[Number, Iterable[Number]], maximum:
Union[Number, Iterable[Number]])
I think that's overcomplicating it. How often have you actually wanted
that feature?
If you want bounds that are iterables, just use min/max on them first.
Another point: min and max accept either a single iterable or multiple
values, but not a mixture, so they set a precedent for 'clamp' not
accepting a mixture too.
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/python-ideas@python.org/message/OEHVQXY2JT6ESPRJ2K7RX2RQ4RJCOHLH/
Code of Conduct: http://python.org/psf/codeofconduct/