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

There are lots of language specific features that library authors use, like operator overloading, ABCs etc...

Python is a great language, and I always opt for it when it's an option, but I've used it to write front-end code, and it sucks.


On 12 August 2017 at 00:46, Alberto Berti <alberto@metapensiero.it> wrote:
>>>>> "Carl" == Carl Smith <carl.input@gmail.com> writes:

    Carl> Python is not a good fit for the browser, in part, because of the syntax.
    Carl> JavaScript has issues, but its syntax is better suited to creating GUIs in
    Carl> the browser.

Just so?

    Carl> For example, in browsers everything revolves around a single
    Carl> threaded event loop, so you have a lot of callbacks and event
    Carl> handlers,

You can write applications full of callbacks using libraries like
Twisted or even asyncio and you can build entire applications involving
ajax and such without callbacks as JS got async/await too in ES8

event handlers are written more or less the same in Pyhton or
Javascript

    Carl> which makes function expressions really useful, but Python doesn't have
    Carl> expressions that contain blocks, because of significant
    Carl> indentation.

yes, i agree that the difference between lambda an anonymous function is
very significant on the way you may think to write your code.

    Carl> As a result, ordinary JS, like this...

    Carl>     $(function(){ $("spam").click(function(){ alert("spam clicked") }) });

I don't think you mean this is real JS application code :-)

    Carl> ...ends up looking like this...

    Carl>     def on_ready():
    Carl>         def click_handler(): alert("spam clicked")
    Carl>         jQuery("spam").click(click_handler)
    Carl>     jQuery(on_ready)

or just

   jQuery(lambda: jQuery("spam").click(lambda: alert("spam clicked")))


    Carl> JS semantics means JS libraries, which have APIs that assume JS syntax.
    Carl> Python library developers make heavy use of language specific features to
    Carl> define elegant, Pythonic APIs, which is a big part of what makes the
    Carl> language so nice to use.

language specific features... like?


_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/