New submission from Dan Snider:
They behave like sets yet their repr looks like a list: dict_keys([0, 1, 3,
4]). It should be dict_keys({0, 1, 2, 3, 4}). Ditto for
odict_keys/odict_values. Maybe this is a holdover from when the repr of sets
was Set([0, 1, 2, ...])?
The reason I bring this up is that they behave like sets was one of the last
things I learned. I learned about stuff like abcs, metaclasses (including stuff
like __prepare__ and __init_subclass__) and memorized practically all of the
standard library long before I realized this.
I don't think it would break anything to do this and it could help dummies like
me realize their set-like behavior sooner.
It might also be nice to give them the explicit `symmetric_difference`,
`union`, and `intersection` methods in addition to the respective `__xor__`,
`__or__`, and `__and__` methods.
----------
messages: 302803
nosy: bup
priority: normal
severity: normal
status: open
title: Change repr of dict_keys, dict_values, and dict_items to use curly braces
type: enhancement
versions: Python 3.7
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue31563>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com