[Python-ideas] Function composition (was no subject)
Chris Angelico
rosuav at gmail.com
Thu May 7 11:41:18 CEST 2015
On Thu, May 7, 2015 at 7:09 PM, João Santos <jmcs at jsantos.eu> wrote:
> On Wed, 6 May 2015 at 16:51 Steven D'Aprano <steve at pearwood.info> wrote:
>>
>>
>> I think that there are some questions that would need to be answered.
>> For instance, given some composition:
>>
>> f = math.sin @ (lambda x: x**2)
>>
>> what would f.__name__ return? What about str(f)?
>
>
> Lambdas return '<lambda>' so maybe something like '<composed>'?
> Then str(f) would be '<function <composed> at 0xffffffffffff>'.
Would be nice to use "<sin @ <lambda>>", incorporating both names, but
that could get unwieldy once you compose a bunch of functions.
ChrisA
More information about the Python-ideas
mailing list