On Saturday, July 4, 2020, at 03:16 -0500, Federico Salerno
wrote:
On 04/07/2020 02:50, Christopher Barker wrote:
FWIW, numpy calls it "clip"
I feel clip fits best with the idea of a collection to... clip.
`clamp()` would work with scalars, for which the word clip might
not be
clear at a glance. While I have no strong feelings in favour of
clamp, I
do think it would be better than clip (but maybe it's just my
experience
with CSS speaking). As far as other options go, I agree with Mr
D'Aprano's objection to `minmax`, and I'd like to toss a
possible
`coerce` (similarly used in Kotlin) into the hat. Maybe someone
has
better names in mind?
Coerce makes me think of types¹ rather than values. YMMV.
¹ https://en.wikipedia.org/wiki/Type_conversion
--
“Whoever undertakes to set himself up as a
judge of Truth and Knowledge is shipwrecked
by the laughter of the gods.” – Albert Einstein
Dan Sommers, http://www.tombstonezero.net/dan
_______________________________________________
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/IEOUDGICPLMF5B374A3ITUKSRAIKBE62/
Code of Conduct: http://python.org/psf/codeofconduct/