On Thu, Aug 03, 2000 at 11:14:57AM -0400, Fred L. Drake, Jr. wrote: > Thomas Wouters writes: > > >>> 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)' > What version is this with? 1.5.2 gives me: > > Python 1.5.2 (#1, May 9 2000, 15:05:56) [GCC 2.95.3 19991030 (prerelease)] on linux-i386 > Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam > >>> x = xrange(2) > >>> str(x) > '(xrange(0, 2, 1) * 1)' > >>> repr(x) > '(xrange(0, 2, 1) * 1)' > >>> x > (0, 1) Sorry, my bad. I just did 'x', and assumed it called repr(). I guess my newbiehood shows in that I thought 'print x' always called 'str(x)'. Like I replied to Tim this morning, after he caught me in the same kind of ebmarrasing thinko: Sigh, that's what I get for getting up when my GF had to and being at the office at 8am. Don't mind my postings today, they're likely 99% brainfart. Seeing as how 'print "range: %s"%x' did already use the 'str' and 'repr' output, I see no reason not to make 'print x' do the same. So +1. > >>> x > xrange(0, 2, 1) > > (Where the outer (... * n) is added only when n != 1, 'cause I think > that's just ugly.) Why not remove the first and last argument, if they are respectively 0 and 1? >>> xrange(100) xrange(100) >>> xrange(10,100) xrange(10, 100) -- Thomas Wouters <thomas@xs4all.net> Hi! I'm a .signature virus! copy me into your .signature file to help me spread!
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4