|
|
Subscribe / Log in / New account

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

> joke suggestion of using the Unicode snowflake

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.


to post comments

Python sets, frozensets, and literals

Posted Jan 19, 2022 12:36 UTC (Wed) by k3ninho (subscriber, #50375) [Link]

>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).

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.


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds