Python sets, frozensets, and literals
Python sets, frozensets, and literals
Posted Jan 19, 2022 6:54 UTC (Wed) by sub2LWN (subscriber, #134200)Parent article: Python sets, frozensets, and literals
Sets could be frozen by default unless they are surrounded by 🌞 ("Sun with Face") to thaw the set. If you want all of the sets within a given scope to be thawed, just bracket it with 🌞🌞🌞, similar to the "triple double quote" string syntax. This could be called a heatwave, among other things.
Posted Jan 19, 2022 12:36 UTC (Wed)
by k3ninho (subscriber, #50375)
[Link]
Current practice is what it is from history. I think that declarative-paradigm languages and immutability go together to form pragmatic functional programming, maybe over time the performance benefits of having everything hashable and sorted would put pressure towards an approach that's mutable-in-the-exception.
K3n.
Python sets, frozensets, and literals
...or extend current practice with a one-way freezing method (though an unfreezing pattern would emerge and adoption into the standard library of something akin to deepcopy-into-new should also spit out a warning to stderr that you're doing a performance anti-pattern).