[Python-ideas] Consider adding clip or clamp function to math

Victor Stinner victor.stinner at gmail.com
Fri Aug 12 19:25:58 EDT 2016


In short, a PEP is a summary of a long discussion. IMHO a PEP is required
to write down the rationale and lists most important alternative and
explain why the PEP is better.

The hard part is to write a short but "complete" PEP.

I tried to follow this discussion and I still to understand why my
proposition of "def clamp(min_val, value, max_val): return min(max(min_val,
value), max_val)" is not good. I expect that a PEP replies to this question
without to read the whole thread :-)

I don't recall neither what was the "conclusion" for NaN.

Victor

Le 10 août 2016 00:43, "Chris Barker" <chris.barker at noaa.gov> a écrit :
>
> Is this idea still alive?
>
> Despite the bike shedding, I think that some level of consensus may have
been reached. So I suggest that either Neil (because it was your idea) or
Steven (because you've had a lot of opinions, and done a lot of the
homework) or both, of course, put together a reference implementation and a
proposal, post it here, and see how it flies.
>
> It's one function, so hopefully won't need a PEP, but if your proposal
meets with a lot of resistance, then you could turn it into a PEP then. But
getting all this discussion summaries would be good as a first step.
>
> NOTE: I think it's a fine idea, but I've got way to omay other things I'd
like to do first -- so I'm not going to push this forward...
>
> -CHB
>
>
>
>
> On Fri, Aug 5, 2016 at 10:24 PM, Stephen J. Turnbull <
turnbull.stephen.fw at u.tsukuba.ac.jp> wrote:
>>
>> Steven D'Aprano writes:
>>  > On Fri, Aug 05, 2016 at 11:30:35PM +0900, Stephen J. Turnbull wrote:
>>  >
>>  > > I can even think of a case where clamp could be used with a constant
>>  > > control and a varying bound: S-s inventory control facing occasional
>>  > > large orders in an otherwise continuous, stationary demand process.
>>  >
>>  > Sounds interesting. Is there a link to somewhere I could learn more
>>  > about this?
>>
>> The textbook I use is Nancy Stokey, The Economics of Inaction
>>
https://www.amazon.co.jp/s/ref=nb_sb_noss?__mk_ja_JP=%E3%82%AB%E3%82%BF%E3%82%AB%E3%83%8A&url=search-alias%3Daps&field-keywords=nancy+stokey+economics+inaction
>>
>> The example I gave is not a textbook example, but is an "obvious"
>> extension of the simplest textbook models.
>> _______________________________________________
>> Python-ideas mailing list
>> Python-ideas at python.org
>> https://mail.python.org/mailman/listinfo/python-ideas
>> Code of Conduct: http://python.org/psf/codeofconduct/
>
>
>
>
> --
>
> Christopher Barker, Ph.D.
> Oceanographer
>
> Emergency Response Division
> NOAA/NOS/OR&R            (206) 526-6959   voice
> 7600 Sand Point Way NE   (206) 526-6329   fax
> Seattle, WA  98115       (206) 526-6317   main reception
>
> Chris.Barker at noaa.gov
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20160813/5c800c48/attachment.html>


More information about the Python-ideas mailing list