Append to several lists inside list
Question: I have an empty list of empty lists defined like so:

    
    
    lis_A = [[], [], []]
    

to which I need, at some point in my code, to append values recursively like
so:

    
    
    lis_A[0].append(some_value0)
    lis_A[1].append(some_value1)
    lis_A[2].append(some_value2)
    

so it looks like this:

    
    
    print lis_A
    [[some_value0], [some_value1], [some_value2]]
    

What is the pythonic way of doing this?


Answer: 
    >>> lis_A = [[], [], []]
    >>> vals = [1,2,3]
    >>> [x.append(y) for x, y in zip(lis_A, vals)]
    >>> lis_A
    [[1], [2], [3]]
    

Or if you wan't a fast for loop without side effects use:

    
    
    from itertools import izip
    
    for x, y in izip(lis_A, vals):
        x.append(y)
    

