Comment on ES6 in Depth: DestructuringparentComments−jeswin11yMy question is, why? If one wanted this type of guarantee consistently, they might as well use a statically typed language.Add: To clarify, the error shows up at runtime in Python. So you're going to need tests anyway. Just as in JS.Btw (unrelated), you can do the same thing in JS as well [a, b, ...rest] = [1, 2, 3, 4, 5]
Comments
My question is, why? If one wanted this type of guarantee consistently, they might as well use a statically typed language.
Add: To clarify, the error shows up at runtime in Python. So you're going to need tests anyway. Just as in JS.
Btw (unrelated), you can do the same thing in JS as well [a, b, ...rest] = [1, 2, 3, 4, 5]