Hello, On Wed, 17 Feb 2021 18:43:09 -0300 "Joao S. O. Bueno" <[email protected]> wrote:
> On Wed, 17 Feb 2021 at 18:15, Abdulla Al Kathiri < > [email protected]> wrote: > > > How is this not pythonic? > > > > series.apply(x -> x**2) > > Compared to.. > > series.apply(lambda x: x**2) > > > > > > (x, y) -> x+y, () -> 0, (x) -> x**2 (for single parameter, we can > > write it without parenthesis like the example above) are pythonic > > enough to my eyes. As said many times already, that's not Pythonic, because "->" is used in Python for return *type* annotation, and thus cannot be used as lambda synonym (without hampering understandability for machines and humans). To illustrate it, (x, y) -> x + y translates to: Callable[[x, y], x + y] while (x, y) => x + y translates to: lambda x, y: x + y Huge difference. > Well, for m eyes, the above is definetellly "perlonic" . it could be > "j" before being Pyrhon. That's unlikely, in Perl it would be something like $x+$y $) ql/x y/. As was said from the very beginning, "(x, y) => x + y" is "JavaScriptonic". For reference, JavaScript is the world's leading programming language, and now even turned out that it has some "good parts" (much later than originally supposed). So, people are looking how to "steal" those good parts. (Just the same as previously, JS "stole" generators from Python). -- Best regards, Paul mailto:[email protected] _______________________________________________ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/[email protected]/message/MRNRM777SG5L5W6QMVUSKHJDCUYUKNCV/ Code of Conduct: http://python.org/psf/codeofconduct/
