Re: Pretty printing dicts with compact=True

2018-09-11 Thread Nicolas Hug
To me it also seems to be the most sensible behaviour, since dictionaries with their keys and values are different from most other sequences. You've got a point but 1. That goes against the compact=True expected behaviour 2. Small dicts (e.g. /{x: x for x in range(5)}/) are still printed on a

Re: Pretty printing dicts with compact=True

2018-09-11 Thread Max Zettlmeißl via Python-list
On Tue, Sep 11, 2018 at 1:58 PM, Nicolas Hug wrote: > pprint({x: x for x in range(15)}, compact=True) > > would be be printed in 15 lines while it could fit on 2. > > > Is this a bug or was this decided on purpose? It is on purpose as can be seen in the code for pprint [1], which calls _format [2

Pretty printing dicts with compact=True

2018-09-11 Thread Nicolas Hug
Is there a reason why the 'compact' parameter is ignored when pretty printing a dict? For example: pprint({x: x for x in range(15)}, compact=True) would be be printed in 15 lines while it could fit on 2. Is this a bug or was this decided on purpose? Thank you! -- https://mail.python.org/mai