I am using frozenset and I would like to avoid the output containing 'frozenset'. For example, I have
x = [frozenset([item]) for item in Set]
Output: frozenset(['yes']) => frozenset(['red', 'blue'])
Any ideas?
I am using frozenset and I would like to avoid the output containing 'frozenset'. For example, I have
x = [frozenset([item]) for item in Set]
Output: frozenset(['yes']) => frozenset(['red', 'blue'])
Any ideas?
You can do this by creating a subclass of
frozenset
and overriding its__repr__
method: