Raymond Hettinger added the comment:
In this case, practicality beats purity. We want to repr to show the contents
of the dictionary (that improves usability). The general rule that repr's need
to round-trip is only a general rule and has many exceptions. As of course, in
this case, it isn'
New submission from Tadhg McDonald-Jensen:
Currently the string representation for dictionary views are a bit misleading
as they look like valid expression but isn't:
>>> {'a':1, 'b':2}.keys()
dict_keys(['b', 'a'])
>>> dict_keys = type({}.keys()) #get a reference to the type
>>>