What does pix[x, y] mean in Python
python, syntax, tuples
Solution
pix[x, y]
is the same as
t = x, y
pix[t]
or
t = (x, y)
pix[t]
or
pix[(x, y)]
What you're seeing is a tuple literal inside an item-getting expression, in the same way that I can nest other expressions such as `l[1 if skip else 0]`
Problem
I find a strange statement when I'm reading PIL document. In 1.1.6 and later, load returns a pixel access object that can be used to read and modify pixels. The access object behaves like a 2-dimensional array, so you can do: ``` pix = im.load() print pix[x, y] pix[x, y] = value ``` What does `pix[x, y]` mean here? It's not slicing syntax because `,` used rather than `:`.