What benefit i get from frozensets?
What benefit i get from frozensets?
Posted Jan 19, 2022 6:24 UTC (Wed) by dambacher (subscriber, #1710)Parent article: Python sets, frozensets, and literals
Even the given example of indirect usage via an "a in {b,c}" expression was never on my list.
So what use do I have from frozensets -
Are they faster on some accessing functions, e.g. "in"?
Do they use less memory?
Posted Jan 19, 2022 7:04 UTC (Wed)
by LtWorf (subscriber, #124958)
[Link]
Sets automatically remove duplicates and have operations such as intersection and subtraction. In general when you use the "in" operator and don't care about ordering, you should always be using a set.
Frozensets are not mutable so, can be used as default parameter to functions, can be used inside other (frozen)set.
What benefit i get from frozensets?