Raymond Hettinger email@example.com added the comment:
This is an artifact of how in-place operators work (which is a topic covered in the Library Reference). It doesn't really have anything to do with frozensets specifically. For example, you see the same effect with tuples which like frozensets are immutable and do not implement any of the in-place dunder methods:
>>> s = ('a', 'b', 'c') >>> s += ('d', 'e') >>> s ('a', 'b', 'c', 'd', 'e')
IIRC, this is the first time this has come-up in the 15 year history of sets, so I don't think there is a real problem to be solved. At best, this should be a FAQ entry or relegated to StackOverflow. I would prefer not to alter the set documentation because doing so would likely create confusion rather than solve it.
---------- assignee: docs@python -> rhettinger resolution: -> rejected stage: -> resolved status: open -> closed