##// END OF EJS Templates
py3: alias xrange to range in tests/seq.py...
Pulkit Goyal -
r35151:08b8b56b default
parent child Browse files
Show More
@@ -1,24 +1,27 b''
1 #!/usr/bin/env python
1 #!/usr/bin/env python
2 #
2 #
3 # A portable replacement for 'seq'
3 # A portable replacement for 'seq'
4 #
4 #
5 # Usage:
5 # Usage:
6 # seq STOP [1, STOP] stepping by 1
6 # seq STOP [1, STOP] stepping by 1
7 # seq START STOP [START, STOP] stepping by 1
7 # seq START STOP [START, STOP] stepping by 1
8 # seq START STEP STOP [START, STOP] stepping by STEP
8 # seq START STEP STOP [START, STOP] stepping by STEP
9
9
10 from __future__ import absolute_import, print_function
10 from __future__ import absolute_import, print_function
11 import sys
11 import sys
12
12
13 if sys.version_info[0] >= 3:
14 xrange = range
15
13 start = 1
16 start = 1
14 if len(sys.argv) > 2:
17 if len(sys.argv) > 2:
15 start = int(sys.argv[1])
18 start = int(sys.argv[1])
16
19
17 step = 1
20 step = 1
18 if len(sys.argv) > 3:
21 if len(sys.argv) > 3:
19 step = int(sys.argv[2])
22 step = int(sys.argv[2])
20
23
21 stop = int(sys.argv[-1]) + 1
24 stop = int(sys.argv[-1]) + 1
22
25
23 for i in xrange(start, stop, step):
26 for i in xrange(start, stop, step):
24 print(i)
27 print(i)
General Comments 0
You need to be logged in to leave comments. Login now