"Paul McGuire" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> "John Henry" <[EMAIL PROTECTED]> wrote in message 
> news:[EMAIL PROTECTED]
snip

Grrrr... that's what I get for not keeping editor and interpreter windows in 
sync.  My post was referencing vars I had defined in the interpreter, but 
which the function had no clue of. !!!  Here's a working version.

-- Paul


def splitUp(src,lens):
    ret = []
    cur = 0
    for length in lens:
        if length is not None:
            ret.append( src[cur:cur+length] )
            cur += length
        else:
            ret.append( src[cur:] )
    return ret

origlist = list("ABCDEFGHIJ")
alist, blist, clist, dlist = splitUp( origlist, (1,1,3,None) )
print alist, blist, clist, dlist


-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to