On Thu, May 7, 2015 at 7:09 PM, Jo?o Santos <jmcs@jsantos.eu> wrote:
On Wed, 6 May 2015 at 16:51 Steven D'Aprano <steve@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.
Maybe it would be better to have '<function <composed> at 0xffffffffffff>' for str(f) but 'sin @ <lambda>' for repr (f). So that one can have more info and it would be closer to idealistic obj == eval (repr (obj)).