[Python-ideas] Towards harmony with JavaScript?

Alberto Berti alberto at metapensiero.it
Fri Aug 11 16:31:50 EDT 2017


>>>>> "Chris" == Chris Angelico <rosuav at gmail.com> writes:

    Chris> Speaking as someone whose day job is teaching Python and
    Chris> JavaScript,

I have some "I'm a good teacher" stickers laying somewhere, do you want
me to send them to you so you can put them somewhere? 


    Chris> I don't like the idea of this kind of thing. You're bringing (some)
    Chris> Python syntax, but sticking to JS semantics. That means your source
    Chris> code looks like Python, but runs like JS. You can't afford to ever run
    Chris> it through a Python interpreter (the semantics will be wrong).

Not always, The tool has a bunch of tests that do evaluate some code
with the two interpreters and then check the results. To some degree it works...

    Chris> There's already plenty of confusion in the world. I don't want to add
    Chris> more.

YOU don't want to add? :-)

    Chris> It would be far better to base your language on JS syntax, since
    Chris> it's using JS semantics; just add in a handful of Python features that
    Chris> you really miss.

It's not really so confusing, most code I wrote with it it's perfectly
understandable Python code. For me, one thing is the language, one other
thing are the libraries or the builtin classes it's usually shipped
with.

The tool reads valid Python and writes valid ES6 JavaScript. As the
documentation states, it allows you to retain most of Python language
semantics (like for example you can have a working
try...except...finally statement, instead of what vanilla JS gives you)
and some of the library semantics. nothing more, nothing less.



More information about the Python-ideas mailing list