- 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