[Python-ideas] pprint in displayhook
Steven D'Aprano
steve at pearwood.info
Sat Sep 28 02:16:13 CEST 2013
On Fri, Sep 27, 2013 at 01:07:18PM +0300, Serhiy Storchaka wrote:
> What are you think about using pprint.pprint() to output the result of
> evaluating an expression entered in an interactive Python session (and
> in IDLE)?
Well, let's try it and see...
py> L = list(range(50))
py> print(L)
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37,
38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49]
py> pprint.pprint(L)
[0,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26,
27,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39,
40,
41,
42,
43,
44,
45,
46,
47,
48,
49]
That would be an Absolutely Not.
However, if somebody wanted to give pprint some attention to make it
actually pretty print, that would be very welcome.
--
Steven
More information about the Python-ideas
mailing list