Did I find the right examples for you? yes no

All Samples(197487)  |  Call(197482)  |  Derive(0)  |  Import(5)
range([start,] stop[, step]) -> list of integers

Return a list containing an arithmetic progression of integers.
range(i, j) returns [i, i+1, i+2, ..., j-1]; start (!) defaults to 0.
When step is given, it specifies the increment (or decrement).
For example, range(4) returns [0, 1, 2, 3].  The end point is omitted!
These are exactly the valid indices for a list of 4 elements.

src/s/h/shedskin-HEAD/examples/go.py   shedskin(Download)
        self.findstamp = TIMESTAMP
        self.removestamp = REMOVESTAMP
        self.zobrist_strings = [random.randrange(sys.maxint) for i in range(3)]
 
    def set_neighbours(self): 
    def __init__(self, board):
        self.board = board
        self.empties = range(SIZE*SIZE)
        self.empty_pos = range(SIZE*SIZE)
 
    def __init__(self):
        self.squares = [Square(self, pos) for pos in range(SIZE*SIZE)]
        for square in self.squares:
            square.set_neighbours()
        self.reset()
    def __repr__(self):
        result = []
        for y in range(SIZE):
            start = to_pos(0, y)
            result.append(''.join([SHOW[square.color]+' ' for square in self.squares[start:start+SIZE]]))

src/s/h/shedskin-HEAD/examples/chess.py   shedskin(Download)
setup = (4, 2, 3, 5, 6, 3, 2, 4, iNone, iNone) + (iTrue,)*4 + (iNone, iNone) +   (1,) * 8 + (iNone, iNone, iTrue, iNone, iNone, iNone, iNone, iNone,) +   ((0, ) * 8 + (iNone,) * 8) * 4 +   (-1,) * 8 + (iNone,) * 8 +   (-4, -2, -3, -5, -6, -3, -2, -4) + (iNone,) * 40
 
squares = tuple([i for i in range(128) if not i & 8])
knightMoves = (-33, -31, -18, -14, 14, 18, 31, 33)
bishopLines = (tuple(range(17, 120, 17)), tuple(range(-17, -120, -17)), tuple(range(15, 106, 15)), tuple(range(-15, -106, -15)))

src/p/y/pypybox2d-2.1-r331/examples/pyramid-bench.py   pypybox2d(Download)
 
    fixture = b2.Fixture(b2.Polygon(box=box_half_size), density=box_density)
    for i in range(box_rows):
        y = copy(x)
 
        for j in range(i, box_rows):
    init_time = time.time() - start
 
    range_ = range(iters)
 
    TIMESTEP = 1.0 / 60

src/i/p/ipython-0.13.1/docs/examples/parallel/itermapresult.py   ipython(Download)
# one call per task
print("running with one call per task")
amr = v.map(sleep_here, [.01*t for t in range(100)])
tic = time.time()
for i,r in enumerate(amr):
    print("task %i on engine %i: %.3f" % (i, r[0], time.time()-tic))
 
print("running with four calls per task")
# with chunksize, we can have four calls per task
amr = v.map(sleep_here, [.01*t for t in range(100)], chunksize=4)
print("running with two calls per task, with unordered results")
# We can even iterate through faster results first, with ordered=False
amr = v.map(sleep_here, [.01*t for t in range(100,0,-1)], ordered=False, chunksize=2)
tic = time.time()
for i,r in enumerate(amr):

src/m/o/modred-0.3.2/examples/tutorial_ex3.py   modred(Download)
num_vecs = 30    
direct_snapshots = [MR.ArrayTextVecHandle('direct_vec%d.txt' % i) 
    for i in range(num_vecs)]
adjoint_snapshots = [MR.ArrayTextVecHandle('adjoint_vec%d.txt' % i)
    for i in range(num_vecs)]
x = N.linspace(0, N.pi, 200)
for i, snap in enumerate(direct_snapshots):
    snap.put([N.sin(x*i) for i in range(num_vecs)])
for i, snap in enumerate(adjoint_snapshots):
    snap.put([N.cos(0.5*x*i) for i in range(num_vecs)])
# The BPOD modes are saved to disk
num_modes = 10
mode_nums = range(num_modes)  
direct_modes = [MR.ArrayTextVecHandle('direct_mode%d' % i) 
    for i in mode_nums]

src/p/y/PyProp-HEAD/examples/combined/hd+_vibration/figures.py   PyProp(Download)
	ax = gca()
 
	for i in range(0,8):
		f = fft.fft(W * cControl[s,i])[:N/2]
		ax.plot(k, abs(f), label="$|%i\\rangle$" % i)
	barHeight = abs(corr)**2
 
	for i in range(basisCount):
		bar(left[i], barHeight[i], color=colors[i%len(colors)])
	#ax.bar(left, barHeight)
 
		for i, delay in enumerate(r_[280:310]):
			for j in range(stateCount):
				ax = subplot(stateCount, delayCount, (delayCount*j) + i + 1)
				DrawBigClock(theta=theta[i,j], drawLines=False, drawTicks=False)

src/c/s/csc-pysparse-1.1.1.4/examples/poisson_test.py   csc-pysparse(Download)
def poisson2d(n):
    L = spmatrix.ll_mat(n*n, n*n)
    for i in range(n):
        for j in range(n):
            k = i + n*j
def poisson2d_sym(n):
    L = spmatrix.ll_mat_sym(n*n)
    for i in range(n):
        for j in range(n):
            k = i + n*j
def poisson2d_sym_blk(n):
    L = spmatrix.ll_mat_sym(n*n)
    I = spmatrix.ll_mat_sym(n)
    P = spmatrix.ll_mat_sym(n)
    for i in range(n):

src/v/i/viz_scripts-HEAD/src/matplotlib_scripts/matplotlib_example_scripts.py   viz_scripts(Download)
 
    axisNum = 0
    for row in range(5):
        for col in range(5):
            axisNum += 1
def example_hatching():
    fig = plt.figure()
    ax1 = fig.add_subplot(131)
    ax1.bar(range(1, 5), range(1, 5), color='red', edgecolor='black', hatch="/")
    ax1.bar(range(1, 5), [6] * 4, bottom=range(1, 5), color='blue', edgecolor='black', hatch='//')

src/p/y/pycircuit-HEAD/pycircuit/post/jwdb/test/example.py   pycircuit(Download)
    ## Read the simulation parameters (temperature, ...)
    params = {}
    for i in range(1,n+1):
        tmp, name, val = jwdb.ams_sim_get_simulation_parameter_info(fileid, i)
        params[name] = val

src/i/p/ipython-py3k-HEAD/docs/examples/newparallel/multiengine2.py   ipython-py3k(Download)
 
ar1 = mux.apply(time.sleep, 5)
ar2 = mux.push(dict(a=10,b=30,c=list(range(20000)),d='The dog went swimming.'))
ar3 = mux.pull(('a','b','d'), block=False)
 

  1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9  Next