4 ms·
> First off, you're plain wrong about Python They’re not. The syntax was changed sometime between Python 3.8 and 3.10 to stop working (which should be a big hi
by minitech 5y ago
> First off, you're plain wrong about Python
They’re not. The syntax was changed sometime between Python 3.8 and 3.10 to stop working (which should be a big hint about the consensus here).
As I suspected, that it worked was accidental from the very beginning: https://bugs.python.org/issue40631#msg384094 https://bugs.python.org/issue40631#msg384094
> Why `console.log` fails on `((...x))` is not because the function can't take arrays as arguments (in fact, it can: `console.log(["hello","world"])` works fine), but rather because it's running into another spec: inline arrow function notation, i.e., `(...x) => true`. So the spec (because it's so confusing) thinks I'm trying to define a function.
What does taking arrays as arguments have to do with anything? Are you suggesting `console.log((...x))` should be equivalent to `console.log([...x])`?
`(...x)` doesn’t fail to work because some kind of syntax conflict with arrow functions[1]. It fails to work because it’s not defined in the language, and it’s not defined in the language because it doesn’t make sense. You’re the only person who seems to think it does.
And if you want to use parentheses for readability, you should write `...(expr)`, `*(expr)`, etcetera.
[1] f((a = {})) and f((a = {}) => {}), for example, are both valid expressions where the inner parentheses mean completely different things, analogous to the ellipsis.