3 ms·
I'm not sure why they removed the ability to destructure sequences in args. It bugs me sometimes as well. There's probably a long discussion about the rationa
by xapata 6y ago
I'm not sure why they removed the ability to destructure sequences in args. It bugs me sometimes as well. There's probably a long discussion about the rationale in some PEP and an even longer email thread.
- mesaframe 6y agoThey did? Afaik, it's there.
- pansa2 6y ago> There's probably a long discussion about the rationale in some PEP PEP 3113 -- Removal of Tuple Parameter Unpacking: https://www.python.org/dev/peps/pep-3113/ https://www.python.org/dev/peps/pep-3113/
- xapata 6y agoThat's a decent argument. It's more typing (in both senses!) to use a specific type as the parameter instead of unpacking in the signature, but it's just as or more readable that way.
- carapace 6y agoYeah, I was so bummed when they did that. I had a whole library of functions for a stack-based interpreter that destructured the stack in the function sig, and it was sooooo coooool... def add((a, (b, stack))): return a + b, stack def uncons(((head, tail), stack)): return tail, (head, stack) &c...