Python lambda with double loops
Question: Is it possible to rewrite the following code into a lambda expression?

    
    
    for h in range(height):
        for w in range(width):
            if maskImg[h][w] > 0:
                maskImg[h][w] = srcImg[h][w]
    


Answer: This is not really equivalent to you expression since this is not in-place,
but you achieve the same end matrix using something like:

    
    
    lambda_function = lambda height, width, src, mask: [[src[h][w] if mask[h][w] > 0 else mask[h][w] for w in range(width)] for h in range(height)]
    

But I would not recommend using it, ever. If you're after speed you should
definitely use [Numpy](http://www.numpy.org/) for these kinds of things.
Assuming that your `src` and `mask` are stored in Python-lists, you get the
same result much, much faster doing:

    
    
    import numpy as np
    src_np = np.array(src)
    mask_np = np.array(mask)
    mask_np[mask_np > 0] = src_np[mask_np > 0]
    

Which on my computer is ~50 times faster than your solution.

