Set vs. frozenset performance
The frozenset and set implementations are largely shared; a set is simply a frozenset with mutating methods added, with the exact same hashtable implementation. See the Objects/setobject.c source file; the top-level PyFrozenSet_Type definition shares functions with the PySet_Type definition. There is no optimisation for a frozenset here, as there is no need to calculate the … Read more