Author rhettinger
Recipients bup, rhettinger
Date 2017-09-23.21:22:05
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1506201725.67.0.955408999437.issue31563@psf.upfronthosting.co.za>
In-reply-to
Content
Some of these were Guido's design decisions made over a decade ago.  He explicitly choose not have the spelled-out method names (both here in the concrete class and in the corresponding abstract base classes).  It usually isn't a good idea to second guess his long standing decisions which have worked out well in practice.

From my own point-of-view, I prefer not to use the set curly brace notation in the repr for several reasons.

1) Ideally, the reprs for the keys(), values(), and items() should all have a similar look.   The list notation is equally applicable to all of three, but the set notation isn't applicable to the values() which can have duplicates and may have non-hashable values.

2) The keys(), values(), and items() are guaranteed to be in the same order.  The list notation reinforces this fact while the set notation does not.

3) There may be unforeseen usability issues (perhaps the change might falsely imply that there is an underlying set rather than a view of the dict, or perhaps it would imply that the full set() API is supported which it is not).

4) In Python 2, all three methods actually returned lists even though it would have been possible to return a set() for the keys.  Though it isn't required, I do like the continuity in thought between the versions.
History
Date User Action Args
2017-09-23 21:22:05rhettingersetrecipients: + rhettinger, bup
2017-09-23 21:22:05rhettingersetmessageid: <1506201725.67.0.955408999437.issue31563@psf.upfronthosting.co.za>
2017-09-23 21:22:05rhettingerlinkissue31563 messages
2017-09-23 21:22:05rhettingercreate