From: Nicolas F. <ni...@pn...> - 2021-01-27 22:47:30
|
Thanks for the info Jeff. Best regards, -- Nicolas Falliere (ni...@pn...) 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> On Wed, Jan 27, 2021 at 11:46 AM Jeff Allen <ja...@fa...> wrote: > Hi Nicolas, > > This has been suggested as a feature ISTR but is way beyond any plan for > 2.7, which is bug-fixing at best. I'm giving nearly all my time to a > possible Jython 3. > > I agree it seems a natural feature to expect, that Python lambdas (or > functions in general) should match an argument that is a functional > interface (of the right shape). > > Jeff Allen > > > On 27/01/2021 16:51, Nicolas Falliere wrote: > > 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 (ni...@pn...) > 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> > > |