<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 27 October 2017 at 02:23, Chris Barker <span dir="ltr"><<a href="mailto:chris.barker@noaa.gov" target="_blank">chris.barker@noaa.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><span class="gmail-">On Thu, Oct 26, 2017 at 6:32 AM, Paul Moore <span dir="ltr"><<a href="mailto:p.f.moore@gmail.com" target="_blank">p.f.moore@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
Procedural languages, and Python in particular, simply don't work like<br>
that. Functions have arbitrary numbers of arguments, </blockquote><div><br></div></span><div>And can return an arbitrary number of values. OK, technically a single tuple of values, but that does complicate the whole simple chaining thing.</div><div><br></div><div>In short -- Python is not a functional language, even though is supports a number of functional idioms.</div></div></div></div></blockquote><div><br></div><a href="https://bugs.python.org/issue1506122">https://bugs.python.org/issue1506122</a> has a brief discussion of the non-syntactic variant of this proposal:</div><div class="gmail_quote"><br></div><div class="gmail_quote">    functools.compose(len, set, str)(foo) => -> len(set(str(foo)))</div><div class="gmail_quote"><br></div><div class="gmail_quote">The main concerns that resulted in the suggestion being rejected are:</div><div class="gmail_quote"><br></div><div class="gmail_quote">* it isn't clear to folks that aren't already familiar with FP why the call order for the composed functions should be right to left</div><div class="gmail_quote">* it isn't clear why every function other than the rightmost one must accept a single positional arg</div><div class="gmail_quote"><div class="gmail_quote">* it isn't clear why every function other than the leftmost one must return a single result</div><div class="gmail_quote"><br></div><div class="gmail_quote">And it doesn't make sense to provide something more general, because if you're writing genuinely functional code, you do tend to abide by those restrictions.</div><div class="gmail_quote"><br></div><div class="gmail_quote">So given that our position is "We don't even want to add this to the standard library, because the learning curve for using it successfully is too steep", it's even less likely we'd be willing to add syntax for the operation.<br></div><div class="gmail_quote"><br></div></div>By contrast, "FP-for-Python" libraries like toolz [1] can make familiarity with those kinds of concepts and a willingness to abide by the related conventions a pre-requisite for using them. It's just opt-in, the same way that learning to define your own classes (rather than importing existing ones defined elsewhere) is opt-in.<br></div><div class="gmail_extra"><br></div><div class="gmail_extra">Cheers,</div><div class="gmail_extra">Nick.<br></div><div class="gmail_extra"></div><div class="gmail_extra"><br></div><div class="gmail_extra">[1] <a href="https://toolz.readthedocs.io/en/latest/">https://toolz.readthedocs.io/en/latest/</a><br clear="all"></div><div class="gmail_extra"><br>-- <br><div class="gmail_signature">Nick Coghlan   |   <a href="mailto:ncoghlan@gmail.com" target="_blank">ncoghlan@gmail.com</a>   |   Brisbane, Australia</div>
</div></div>