What benefit i get from frozensets?
What benefit i get from frozensets?
Posted Jan 19, 2022 7:04 UTC (Wed) by LtWorf (subscriber, #124958)In reply to: What benefit i get from frozensets? by dambacher
Parent article: Python sets, frozensets, and literals
Well I use frozenset but never used other features.
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.