Auto converting Python lambdas to functional interface impl.
Nicolas Falliere <[email protected]> Wed, 27 Jan 2021 08:51:38 -0800
| Newsgroups | gmane.comp.lang.jython.devel |
|---|---|
| Message-ID | <CAJP=iOXdXGbtB7sULhOjPOBZSD4yriZRbpZ-xpK=zEfrspHTiA@mail.gmail.com> |
Hello dev team,
int foo(BiFunction<Integer, Integer, Integer> f) {
return f.apply(1, 2);
}
foo((a, b) -> a + b ); // ok
I was wondering if Jython 2.7 would auto-convert to idiomatic lambdas, and
tried:
foo(lambda a, b: a + b)
alas, I got a
TypeError: can't convert <function <lambda> at 0x3> to
java.util.function.BiFunction
(same problem with a single-arg lambda, e.g. foo(lambda (a, b): a + b))
Any plan to support that in a future maintenance release, or maybe for
Jython 3?
Thanks,
--
Nicolas Falliere ([email protected])
JEB Decompiler, Founder and Architect
PNF Software <https://www.pnfsoftware.com/> | Follow us on Twitter
<https://twitter.com/jebdec> | Join us on Slack
<https://www.pnfsoftware.com/chat> | Bulletin Board
<https://www.pnfsoftware.com/forum>
_______________________________________________
Jython-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jython-dev