3 ms·
you can't do this consistently across all cases without compiler assistance (see https://doc.rust-lang.org/book/ch19-03-pattern-syntax.html https://doc.rust-lan
by almostgotcaught 1y ago
you can't do this consistently across all cases without compiler assistance (see https://doc.rust-lang.org/book/ch19-03-pattern-syntax.html https://doc.rust-lang.org/book/ch19-03-pattern-syntax.html or https://peps.python.org/pep-0636/#matching-builtin-classes https://peps.python.org/pep-0636/#matching-builtin-classes linked below).
- nikisweeting 1y agoperfect is enemy of good imo, dict destructuring is so valuable that I'm willing to bend some rules / add some rules to make it possible. can't we just copy whatever JS does?
- skeledrew 1y agoIf it's that valuable to you personally you can use that project to remove your "daily pain". No need to inflict the pain caused by such a thing being present in official Python. Some of us like for the language to remain highly readable.
- notpushkin 1y ago> you can use that project It’s not meant for production use. Quite clearly so: https://github.com/asottile/dict-unpacking-at-home#please-dont-use-this https://github.com/asottile/dict-unpacking-at-home#please-do...
- almostgotcaught 1y ago> perfect is enemy of good imo You can't land a language feature that only sometimes works - that's absolutely horrid UX. > can't we just copy whatever JS does? I wasn't aware that js does this and I don't know it's implemented. So maybe I should retract my claim about compiler assistance.
- nikisweeting 1y agoIt's been one of the headline features keeping me happy in JS for 9+ years.