-
Notifications
You must be signed in to change notification settings - Fork 26
Open
Description
The KeysView repr contains all nested items. This differs from dict_keys which contains only the "top-level" keys. Here's a minimal example with UserDict (although not used in roman_datamodels, the abcs that are used like MutableMapping for DNode behave similarly).
>> import collections
>> d = collections.UserDict({"a": {"b": {"c": [1, 2, 3]}}})
>> d.keys()
KeysView({'a': {'b': {'c': [1, 2, 3]}}})
>> d['a'].keys()
dict_keys(['b'])There is some discussion about changing this within python:
python/cpython#76481
but the general consensus at the moment appears to be for subclasses/classes to override the methods to control the behavior.
xref: #524 (comment)
Metadata
Metadata
Assignees
Labels
No labels