[issue43085] Loosening | and |= operator type checking restriction

Brandt Bucher report at bugs.python.org
Mon Feb 1 12:28:35 EST 2021


Brandt Bucher <brandtbucher at gmail.com> added the comment:

Yurii, I agree with Raymond that it's probably not worth adding new ABCs for this.

I'm happy to consider patches that add these operators to concrete stdlib mappings on a case-by-case basis. However, please be aware that we already went through a fairly comprehensive review of each dict/Mapping/MutableMapping subclass (real or virtual) in the entire stdlib to see if they would benefit here. I don't think we bothered updating *any* classes that weren't publicly documented, which is probably why "SignalDict" was left untouched.

It's also important to remember that the motivating use-case for PEP 584 was binary "|", and that "|=" just logically followed from that change. In this specific case, I think just using the good ol' update method (or even item assignment) is probably good enough.

I'm not very familiar with how SignalDict is used, though: do we ever actually want to create a new updated copy using binary "|"? That would probably be enough to convince me.

----------
components: +Library (Lib) -Regular Expressions
versions: +Python 3.10 -Python 3.9

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


More information about the Python-bugs-list mailing list