what is this?

Paul Watson pwatson at redlinepy.com
Thu Jan 4 13:25:03 EST 2007


Eric Price wrote:
> Hello;
> I'm studying some code examples from the python cookbook site. I came 
> across this:
> 
> def colsplit(l, cols):
>    rows = len(l) / cols
>    if len(l) % cols:
>        rows += 1
>    m = []
>    for i in range(rows):
>        m.append(l[i::rows])
>    return m
> 
> What I'd like to know is what is the double colon? What does it do?
>        m.append(l[i::rows])
> 
> Thanks,
> Eric

http://docs.python.org/tut/tut.html
http://docs.python.org/tut/node5.html#SECTION005140000000000000000
http://docs.python.org/ref/slicings.html

Probably most helpful to you is:

http://developer.mozilla.org/es4/proposals/slice_syntax.html



More information about the Python-list mailing list