Python sets, frozensets, and literals
Python sets, frozensets, and literals
Posted Jan 19, 2022 12:36 UTC (Wed) by k3ninho (subscriber, #50375)In reply to: Python sets, frozensets, and literals by sub2LWN
Parent article: Python sets, frozensets, and literals
>Sets could be frozen by default
...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).
...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).
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.