Immutable view classes - inherit from dict or from Mapping?

Serhiy Storchaka storchaka at gmail.com
Tue Apr 13 12:40:00 EDT 2021


13.04.21 15:47, Peter Otten пише:
> As to the | operator, maybe it could be added to Mapping?

The | operator returns a new instance, but constructor is not a part of
the Mapping interface. You cannot make a general implementation, and
making __or__ an abstract method will break all existing Mapping
interface implementations which do not have the __or__ method.



More information about the Python-list mailing list