[Python-Dev] printing xrange objects
Thomas Wouters
thomas@xs4all.net
Thu, 3 Aug 2000 17:00:03 +0200
On Thu, Aug 03, 2000 at 09:06:51AM -0400, Fred L. Drake, Jr. wrote:
> There is no tp_str handler, so str(xrange(...)) is the same as
> repr(xrange(...)).
> I propose ripping out the tp_print handler completely. (And I've
> already tested my patch. ;)
> Comments?
+0... I would say 'swap str and repr', because str(xrange) does what
repr(xrange) should do, and the other way 'round:
>>> x = xrange(1000)
>>> repr(x)
(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
... ... ...
... 998, 999)
>>> str(x)
'(xrange(0, 1000, 1) * 1)'
But I don't really care either way.
--
Thomas Wouters <thomas@xs4all.net>
Hi! I'm a .signature virus! copy me into your .signature file to help me spread!