5 ms·
This is one where I don't see the advantages outweighing the disadvantages. Python is, IMO, a moderately better language than JavaScript, but you don't get the
by JasonFruit 5y ago
This is one where I don't see the advantages outweighing the disadvantages. Python is, IMO, a moderately better language than JavaScript, but you don't get the Python ecosystem, and you aren't running the same code you wrote, so you won't get nice stack traces or even useful error messages. You'll be writing JavaScript in Python, using JavaScript libraries, but all the references are written in JavaScript. It's a lot of mess just to avoid writing JavaScript, which contains a pretty decent language at this point.
- chrisseaton 5y agoIf you have some business logic that you want to run on both the front-end (maybe for quick local validation) and the back-end (for definitive validation) then this is useful over possibly rewriting you Python into JavaScript.
- IshKebab 5y ago> Python is, IMO, a moderately better language than JavaScript Debatable. But either way it's definitely a much worse language than Typescript so I agree.
- jokoon 5y agoThe base syntax of python is already a big plus when compared to js. It's only about avoiding the ambiguity of js, it js in general. I remember making a small webapp in flask and ajax. Most of the code is on the server, it's as little js as possible, and it has no js dependencies.
- peanut_worm 5y agoWhat do you think is better about Python’s syntax? I generally like modern JavaScript’s syntax. I always figured the appealing part about python is the very good standard library.
- jokoon 5y agoList comprehension, the indent syntax that makes it very readable, the builtin functions, globally everything. The philosophy of python is well described here: https://www.python.org/dev/peps/pep-0020/ https://www.python.org/dev/peps/pep-0020/ I especially likes this one: > There should be one-- and preferably only one --obvious way to do it. It's true that the standard library is good, but generally I do more things with basic python than the base of other languages. And honestly I've never understood how js prototypes work. Python just feels better. The syntax is less cluttered. That's a huge point of python.
- BiteCode_dev 5y ago- sequence[-1] - sequence[start:finish:step] - no need for "===" - try/except with specific exceptions - context managers - yield from - "in" on any iterable - raise from - every empty object is false, all other are true - spread work on all iterables, not just arrays - f"{2:03}", f"{2:.2f}" and f"{date:%m/%d/%Y}" - / and // - no need for variable declaration keywords - 0b1111 - "else" in loops - := makes for explicit assignation + comparison instead of a footgun - None instead of null + undefined - set literals - matmul operator - foo > bar > baz - sorting callback semantics - dunder methods for operator overriding - list, dict and set comprehension - generator expressions - byte literals - raise SystemExit() for clean script exit - raw strings - automatic string literal concatenation - positional/keyword only parameters - can use *args and **kwargs together, as opposed to spread - docstrings - typing is part of the language, no need for a transpiled dialect like typescript - "async for" and "async with" That's only what I come up on the fly, I'm pretty sure I can double the list. Then of course, do we consider builtin to be part of the stdlib, since it doesn't require any import? Because there is a load to say there. JS does have some nice stuff too though: - ? and ?? - futures are more ergonomic than coroutines and awaitable anyway - more powerful destructuration - regex literals
- WillDaSilva 5y agoWeakref finalizers can help with instance destruction in Python https://docs.python.org/3/library/weakref.html#weakref.finalize https://docs.python.org/3/library/weakref.html#weakref.final...
- _ZeD_ 5y ago> Python is, IMO, a moderately better language than JavaScript comprehension alone are a game changer - language wise
- jkrubin 5y agoJs has awesome map filter reduce tho. I used to wish js has list comprehensions but now I prefer map filter reduce.
- garyrob 5y agoJS's closest equivalent to comprehensions. Not as nice in my book, but really not bad either. https://sebhastian.com/list-comprehension-javascript/ https://sebhastian.com/list-comprehension-javascript/
- Scarbutt 5y agoHardly a game changer