Is try-except slow?

process circularfunc at gmail.com
Tue Sep 2 21:14:49 EDT 2008


is this faster btw? I guess big doesn't help, it's only retrieved once
anyway? But is rows retrieved in every loop? the python interpreter
aint too smart?

def getPixels(fileName):
    im = PIL.Image.open(fileName)
    colors = []
    r, c = im.size
    big = range(0, c)
    rows = range(0, r)
    for y in big:
        row = []
        for x in rows:
            color = im.getpixel((x,y))
            row.append(color)
        colors.append(row)
    return numpy.array(colors)



More information about the Python-list mailing list