Message54668
| Author |
rhettinger |
| Recipients |
| Date |
2005年11月12日.20:02:10 |
| SpamBayes Score |
| Marked as misclassified |
| Message-id |
| In-reply-to |
| Content |
Logged In: YES
user_id=80475
IMO, such a rewrite would expose too many of pprint's
internals and make the module harder to
use/understand/maintain. Wouldn't it be better to stick
with the usual idiom for controlling the repr() formatting
of specific types by using a class wrapper:
>>> from pprint import pprint
>>> class Int(int):
def __repr__(self):
return hex(self)
>>> pprint([Int(x) for x in range(0x10000000,0x10000010)])
[0x10000000,
0x10000001,
0x10000002,
0x10000003,
0x10000004,
0x10000005,
0x10000006,
0x10000007,
0x10000008,
0x10000009,
0x1000000a,
0x1000000b,
0x1000000c,
0x1000000d,
0x1000000e,
0x1000000f] |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2007年08月23日 16:11:29 | admin | link | issue1351692 messages |
| 2007年08月23日 16:11:29 | admin | create |
|