xrange Questions

28

Solved

Apparently xrange is faster but I have no idea why it's faster (and no proof besides the anecdotal so far that it is faster) or what besides that is different about for i in range(0, 20): for i in...
Doehne asked 18/9, 2008 at 17:52

6

Solved

I am getting an error when running a python program: Traceback (most recent call last): File "C:\Program Files (x86)\Wing IDE 101 4.1\src\debug\tserver\_sandbox.py", line 110, in <module> ...
Cowans asked 19/6, 2013 at 13:13

3

Solved

I would like to change the default x range for the histogram plot. The range of the data is from 7 to 12. However, by default the histogram starts right at 7 and ends at 13. I want it to start at 6...
Westbrook asked 25/8, 2012 at 21:42

6

Solved

Recently I started using Python3 and it's lack of xrange hurts. Simple example: Python2: from time import time as t def count(): st = t() [x for x in xrange(10000000) if x%4 == 0] et = t() pri...
Linsang asked 21/2, 2013 at 23:36

2

Simple question - the range drawn on a plot can be changed with the set xrange [x_min:x_max] command. Does this command also limit the range used when fitting a function using the data fitting too...
Lightsome asked 29/6, 2015 at 22:32

12

Solved

Why or why not?
Ingalls asked 25/9, 2008 at 18:24

1

Solved

I wrote a script which I wanted to enable for both Python 2 and Python 3. After importing division and print_function from __future__, my only concern was that my range returns a whole array in Py...
Uncork asked 15/6, 2016 at 11:38

1

I try to execute following code but can't with mistake: name 'xrange' is not defined pages = ( requests.get( build_group_request({ "offset": WINDOW_SIZE * i, "count": WINDOW_SIZE, "fiel...
Sophi asked 28/6, 2015 at 20:27

2

Solved

I was going through Python Generators Wiki when I came across this RangeGenerator page which talks about irange() - This will let us iterator over large spans of numbers without resorting to xr...
Mallon asked 9/4, 2014 at 18:31

1

Solved

I was trying to inherit xrange (to implement membership testing with in, as well as iteration). But I got the following error message: TypeError: Error when calling the metaclass bases type ...
Mitchel asked 28/2, 2014 at 14:37

9

Solved

range() and xrange() work for 10-digit-numbers. But how about 13-digit-numbers? I didn't find anything in the forum.
Berndt asked 2/2, 2010 at 19:49

1

I want to iterate over a closed range of integers [a, b] in python, ie. iterating from a to b including both a and b. I know the following way of doing it: for i in range(a, b+1): do_something(...
Dc asked 21/4, 2013 at 19:53

3

Solved

I've encountered this code from Most pythonic way of counting matching elements in something iterable r = xrange(1, 10) print sum(1 for v in r if v % 2 == 0) # 4 print sum(1 for v in r if v % 3 ==...
Severally asked 27/5, 2012 at 18:26

3

Solved

What is faster, a for loop using enumerate or using xrange? EDIT: I have tested, and I just see minimal differences.
Armistice asked 31/1, 2011 at 15:56

4

In Python if I wanted a sequence from 0 - 9 (inclusive) I would use xrange(0,10) . Is there a way I can do this in MySQL?
Trove asked 22/3, 2010 at 20:30

5

Solved

xrange function doesn't work for large integers: >>> N = 10**100 >>> xrange(N) Traceback (most recent call last): ... OverflowError: long int too large to convert to int >>...
Epifocal asked 27/9, 2009 at 0:28
1

© 2022 - 2024 — McMap. All rights reserved.