Change the __repr__ of the `MappingView`s

=== This proposition is purely aesthetic === At this time, the __repr__ of the mapping views is showing the whole mapping:
Witch is not consistent with dict_keys, dict_values, dict_items:
We could easily change that, since all the views are iterables on what they are designed for, in MappingView: def __repr__(self): viewname = self.__class__.__name__ elements = ', '.join(map(repr, self)) return f'{viewname}([elements]) And now:
It's not breaking any test (it seems that there isn't any for this), but it have a real drawback: it's breaking the convention about instantiation by copy/pasting:
It's because __init__ in MappingView treat the passed argument -- wich is stored in self._mapping -- as the whole mapping, not just keys, values or items... And all the other methods (__contains__ and __iter__) in the subclasses are using this _mapping attribute to work. So what is to prioritize?

You're right that there's some inconsistency here. But I don't think it's worth fixing given that the fix would introduce another inconsistency (which you pointed out) and would also risk breaking backwards compatibility. I think this ship has sailed. On Sat, Dec 30, 2017 at 5:18 PM, Yahya Abou 'Imran via Python-ideas < python-ideas@python.org> wrote:
-- --Guido van Rossum (python.org/~guido)

You're right that there's some inconsistency here. But I don't think it's worth fixing given that the fix would introduce another inconsistency (which you pointed out) and would also risk breaking backwards compatibility. I think this ship has sailed. On Sat, Dec 30, 2017 at 5:18 PM, Yahya Abou 'Imran via Python-ideas < python-ideas@python.org> wrote:
-- --Guido van Rossum (python.org/~guido)
participants (2)
-
Guido van Rossum
-
Yahya Abou 'Imran