[issue28278] Make `weakref.WeakKeyDictionary.__repr__` meaningful

2016-09-29 Thread Fred L. Drake, Jr.
Fred L. Drake, Jr. added the comment: I don't recall that the issues discussed here were considered when these classes were added; functionality was the issue at the time. I'm not particularly opposed to adding a more data-ful repr for the weakref-oriented mappings, but I'm not really convince

[issue28278] Make `weakref.WeakKeyDictionary.__repr__` meaningful

2016-09-26 Thread Josh Rosenberg
Josh Rosenberg added the comment: Well, I could see a "friendly" repr being avoided to: 1. Save work (iterating safely involves iteration guards and explicitly acquiring strong references to every key) 2. Avoid pretending the state is stable (the repr at time X could be different at time X+eps

[issue28278] Make `weakref.WeakKeyDictionary.__repr__` meaningful

2016-09-26 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- nosy: +fdrake, pitrou versions: +Python 3.7 -Python 3.6 ___ Python tracker ___ ___ Python-bugs-list m

[issue28278] Make `weakref.WeakKeyDictionary.__repr__` meaningful

2016-09-26 Thread Ram Rachum
New submission from Ram Rachum: Both `WeakKeyDictionary` and `WeakValueDictionary` have opaque `__repr__` methods: >>> x = weakref.WeakKeyDictionary({object: 2, type: 4,}) >>> x >>> dict(x) {: 4, : 2} This makes it annoying to view them at a glance. Is there a reason for it? (I don't know, m