New submission from Siyavash <varzeghani.siyav...@gmail.com>:

| and |= operators work only if the operands are of 'dict' type. This means 
that they can't be used with some of the user defined mapping objects.

The case that especially caught my attention was 'SignalDict' type in decimal 
standard library. While 'SignalDict' has got an update method like 'dict', it 
can not be updated with |= operator. The following code results in a TypeError:

decimal.getcontext().traps |= {decimal.DivisionByZero:False}

----------
components: Regular Expressions
messages: 386028
nosy: Siy_V, brandtbucher, ezio.melotti, mrabarnett, steven.daprano
priority: normal
severity: normal
status: open
title: Loosening | and |= operator type checking restriction
type: enhancement
versions: Python 3.9

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue43085>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to