[Python-ideas] Towards harmony with JavaScript?

Alberto Berti alberto at metapensiero.it
Sat Aug 12 07:41:46 EDT 2017


>>>>> "Carl" == Carl Smith <carl.input at gmail.com> writes:

    Carl> Using lambdas doesn't solve the problem. I just kept the example short, but
    Carl> had I used more than one expression in each function, you'd be back to
    Carl> square one. You took advantage of the brevity of the example, but it's not
    Carl> realistic.

Let me elaborate more on this...

yes, i took "advantage" of the brevity of your example, but there's a
another side of it. In my JS coding I usually avoid non trivial
anonymous functions in real applications. The reason is that if an error
happens inside an anonymous function and maybe it was the last one in a
series of anonymous functions the stack trace of that error will end up
with references like "in anonymous function at line xy of 'foo.js'" and
that doesn't allows me get a first idea of what the code was doing when
the error was thrown.

That's why I don't like them and why I don't have a great opinion of
large codebases making extensive usage of them.

It also appears to me that the trend in some (relevant) part of the JS
community if to refrain from use them when possible towards a more
structured approach to coding that resembles more of a class based
componentization, like in react.

cheers,

Alberto



More information about the Python-ideas mailing list