4 ms·
i'm not sure "immutable data" is precise as a complaint here - this is akin to the difference between `const` and `let` in Javascript, which has nothing to do w
by ledauphin 6y ago
i'm not sure "immutable data" is precise as a complaint here - this is akin to the difference between `const` and `let` in Javascript, which has nothing to do with immutability of the data and everything to do with the immutability of a name binding.
I do wish we had better first-class immutable data in Python, but that wouldn't help with the
NOT_FOUND = 404
match val:
case NOT_FOUND:
...
scenario that everyone is (rightly) fixated on, because integers themselves are already immutable.
- macintux 6y agoTrue, I tend to conflate immutable bindings with immutable data. With Erlang, all bindings are immutable, which makes pattern matching more powerful (although it can lead to unexpected crashes on occasion).
- tom_mellior 6y ago> scenario that everyone is (rightly) fixated on Your "rightly" obviously varies, but this scenario is the poster child for enums, and you can match on enum members. The featured article has an example.