>>>>> "Jason" == Jason H <[email protected]> writes:
Jason> While JS is strongly for web (Node.JS, Browsers) and Python has a
weak
Jason> showing (Tornado, Flask), Python is very popular on everything else
on
Jason> the backend where JS isn't and isn't likely to be. The I'm making
Jason> point is not to choose a 'winner', but to make the observation that:
Jason> given that the tight clustering of the two languages there will be
Jason> considerable overlap. People like me are asked to do both quite
Jason> frequently. So I'd like a little more harmony to aid in my
Jason> day-to-day. I have just as many python files as JS files open in my
Jason> editor at this moment.
I too do much work on both "sides"
Jason> There are several annoyances that if removed, would go a long way.
Jason> 1. Object literals: JS: {a:1} vs Python: {'a':1}
Jason> Making my fingers dance on ' or " is not a good use of keystrokes,
Jason> and it decreases readability. However a counter argument here is what
Jason> about when the a is a variable? JS allows o[a] as a way to assigned
to
Jason> a property that is a variable. Python of course offers functions that
Jason> do this, but for simple objects, this would very much be appreciated.
Jason> The point here is this is
Jason> 2. Join: JS: [].join(s) vs Python: s.join([])
Jason> I've read the justification for putting join on a string, and it
makes sense. But I think we should put it on the list too.
Jason> 3. Allow C/C++/JS style comments: JS:[ //, /* ] vs Python #
Jason> This one is pretty self-explanatory.
Other friction points to me are (just to name a few):
* when you have to check if a variable contains a string, you have to
check for both "typeof foo == 'string'" and "foo instanceof String"
* you cannot use negative indexes on Array
* when you want to know the length of a sized object you have to know
(and to remember) how to ask it: Array has .length, newer Map and Set
objects have .size
For the goal of reducing the friction (the mind switching when working
with both the languages) I have created a tool (
https://github.com/azazel75/metapensiero.pj ) which allows me to write
valid Python and translates this to nice JS while taking care of most of
these nuances. At the same time it doesn't raise any barrier between the
translated code and any other JS library around (and I use them a lot).
When I created I wasn't unsure if the goal was worthy, but after
developing some large library with it I must say than I'm quite happy
using it and that I had positive feedbacks from other developers.
I suggest you to take a look at it.
cheers,
Alberto
_______________________________________________
Python-ideas mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/