Why doesn't my heapify work?
skip at pobox.com
skip at pobox.com
Wed Feb 7 13:20:55 EST 2007
ruan> Can't range go from larger to smaller?
Yes. Read the doc:
range(...)
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.
To go from larger to smaller you need a negative step size. Also, note that
the endpoint is never included. range(10) serves up 0 throu 9.
Skip
More information about the Python-list
mailing list