On Mon, Jul 6, 2020 at 12:36 PM Steven D'Aprano <st...@pearwood.info> wrote: > Four years ago, there was strong opposition to giving the bounds default > values. I think the consensus at the time was that it is okay to > explicitly provide "unbounded" arguments (whether you spell them as > infinities, NANs, or None) but you should have to explicitly do so: > > clamp(x) > > just reads poorly.
Yes, but it's also useless (clamping without ANY bounds?). In terms of reading poorly, this is far worse: clamp(x, 10) Does that ensure that it's no *greater* than 10 or no *less* than 10? Since the args would be min before max, I would expect that this has a lower bound and no upper bound, but there'll be people equally confident that it should behave like range() and have an upper bound with no lower bound (which would probably be more useful in a lot of situations anyway). So I also agree that the bounds should be given explicitly. ChrisA _______________________________________________ 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/J5ZPUKV7IMQDJVHF6HTNQNNA6AJZNDMF/ Code of Conduct: http://python.org/psf/codeofconduct/