Message54665
Logged In: YES
user_id=89016
In theory this should be possible by subclassing
pprint.PrettyPrinter and overwritting the format method:
import pprint
class MyPrettyPrinter(pprint.PrettyPrinter):
def format(self, object, context, maxlevels, level):
if isinstance(object, int):
return hex(object), True, False
else:
return pprint.PrettyPrinter.format(self, object,
context, maxlevels, level)
mpp = MyPrettyPrinter()
mpp.pprint(range(50))
This doesn't work reliable though: When the string is short
enough, format() seems to be bypassed and repr() is called
directly.
|
|
Date |
User |
Action |
Args |
2007-08-23 16:11:29 | admin | link | issue1351692 messages |
2007-08-23 16:11:29 | admin | create | |
|