Frozenset Methods

frozenset.copy()

Obtain a shallow immutable set with the same members. Because the receiver cannot change membership, an implementation may return the same object; CPython 3.13.5 does so for exact frozenset instances. Use equality rather than identity to compare the result. Member references are not deep-copied; immutability of the container does not imply deep immutability of arbitrary members.

Formal Syntax & Structure

python syntaxpython
items.copy()

Return Value

frozenset

Shallow copy with equal members.

Working Example

Example Snippetpython
original = frozenset({"read", "write"})clone = original.copy()print(sorted(clone), type(clone).__name__)print(clone == original)print({original: "allowed"}[clone])
Python Reference