homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author markhirota
Recipients
Date 2005年11月14日.18:33:28
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
Logged In: YES 
user_id=1375527
Did some digging into the code and found that the "if 
sepLines:" condition in the PrettyPrinter._format() method 
was the source of the limitation.
I've attached a modified version of pprint.py where the "if 
sepLines" is more embedded. It gives the following results:
>>> import pprintmod
>>> class MyPrettyPrinter(pprintmod.PrettyPrinter):
	def format(self, object, context, maxlevels, level):
		if isinstance(object, int):
			return hex(object), True, 
False
		else:
			return 
pprintmod.PrettyPrinter.format(
				self, object, 
context, maxlevels, level)
		
>>> mpp = MyPrettyPrinter()
>>> mpp.pprint(range(10))
[0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9]
>>> mpp.pprint(range(0x10000000,0x10000010))
[0x10000000,
 0x10000001,
 0x10000002,
 0x10000003,
 0x10000004,
 0x10000005,
 0x10000006,
 0x10000007,
 0x10000008,
 0x10000009,
 0x1000000a,
 0x1000000b,
 0x1000000c,
 0x1000000d,
 0x1000000e,
 0x1000000f]
>>> 
Would this be an acceptable change? Thanks,
History
Date User Action Args
2007年08月23日 16:11:29adminlinkissue1351692 messages
2007年08月23日 16:11:29admincreate

AltStyle によって変換されたページ (->オリジナル) /