[issue40702] frozensets should not allow the |= operator

Chris Cordero report at bugs.python.org
Wed May 20 15:28:14 EDT 2020


New submission from Chris Cordero <ccordero at protonmail.com>:

Frozensets disallow the .update and the .__ior__ methods from being used, but allows the |= operator, which I think is inconsistent with the disallowed methods†.

```
foo = frozenset()
print(foo)             # frozenset()
foo.update({"hello"})  # AttributeError, expected
foo.__ior__({"hello"}) # AttributeError, expected
foo |= {"hello"}       # No error
print(foo)             # frozenset({"hello"})
```

----------
messages: 369470
nosy: cs-cordero
priority: normal
severity: normal
status: open
title: frozensets should not allow the |= operator
type: behavior
versions: Python 3.8

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40702>
_______________________________________


More information about the Python-bugs-list mailing list