3 ms·
Python 2 & 3 have destructuring. This is talking about having def fxn(a, (b, c), d): pass Be a valid function signature. So the destructuring is held i
by ben336 11y ago
Python 2 & 3 have destructuring. This is talking about having
def fxn(a, (b, c), d):
pass
Be a valid function signature. So the destructuring is held in the function definition.
Python 3 will still allow
def fxn(a, x, d):
(b, c) = x
pass
Both Python and ES6 JavaScript allow destructuring arrays:
//javascript
let [x, y] = [1,2]
#python
[x, y] = [1,2]
(x, y) = (1,2)
- Arnavion 11y agoES6 does allow that via destructuring - https://babeljs.io/repl/#?experimental=true&evaluate=true&loose=false&spec=false&playground=true&code=function%20fxn(a%2C%20%5Bb%2C%20c%5D%2C%20d)%20%7B%0A%20%20console.log(a%2C%20b%2C%20c%2C%20d)%3B%0A%7D https://babeljs.io/repl/#?experimental=true&evaluate=true&lo... function fxn(a, [b, c], d) { console.log(a, b, c, d); }