[issue29043] dict view string representations are misleading

2016-12-21 Thread Raymond Hettinger
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

[issue29043] dict view string representations are misleading

2016-12-21 Thread Tadhg McDonald-Jensen
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