[issue45959] Teach pprint about dict views

2022-01-17 Thread Éric Araujo
Éric Araujo added the comment: The PR looks good! When the last comments are resolved, unless there is activity from other core devs, I will merge it. -- nosy: +eric.araujo ___ Python tracker

[issue45959] Teach pprint about dict views

2021-12-16 Thread Daniel Diniz
Daniel Diniz added the comment: I have tried to add this. The PR adds: - PrettyPrinter._pprint_dict_view to handle dict_keys and dict_values (sorted with _safe_key). = PrettyPrinter._pprint_dict_items_view to handle dict_items (sorted using _safe_tuple). - Tests. Would a NEWS entry or other

[issue45959] Teach pprint about dict views

2021-12-16 Thread Daniel Diniz
Change by Daniel Diniz : -- keywords: +patch nosy: +ajaksu2 nosy_count: 4.0 -> 5.0 pull_requests: +28355 stage: -> patch review pull_request: https://github.com/python/cpython/pull/30135 ___ Python tracker

[issue45959] Teach pprint about dict views

2021-12-15 Thread Raymond Hettinger
Raymond Hettinger added the comment: More accurate to say that it aspires to print in a single line ONLY if the content fits in the specified width. Otherwise, it prints vertically with appropriate indentation. Indeed, that is the entire purpose of the module; otherwise, we would just use

[issue45959] Teach pprint about dict views

2021-12-14 Thread Joshua Insel
Joshua Insel added the comment: According to the documentation for pprint, it is supposed to print objects on a single line if possible. See the second paragraph here: https://docs.python.org/3/library/pprint.html -- nosy: +joshinsel ___ Python

[issue45959] Teach pprint about dict views

2021-12-13 Thread David Peled
Change by David Peled : -- nosy: +david-peled ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue45959] Teach pprint about dict views

2021-12-02 Thread Alex Waygood
Change by Alex Waygood : -- nosy: +AlexWaygood ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue45959] Teach pprint about dict views

2021-12-01 Thread Raymond Hettinger
New submission from Raymond Hettinger : The pprint() code has a number of type or protocol specific handlers but doesn't have one for dict views. So, we don't get pretty printing for the key(), values(), and items(): d = {i:i for i in range(100)} pprint(d) # This is handled