python - Is there a more pythonic way to loop over multiple similar indices using list comprehension? -


i have following code

a = [(x(x), y(y), z(z)) x in range(n) y in range(n) z in range(n)] 

it want - produce list of tuples representing cartesian coordinates according functions x, y , z - not pretty. tried

a = [(x(x), y(y), z(z)) x, y, z in range(n)] 

but didn't work. there more elegant , pythonic way this?

from itertools import product = [(x(x), y(y), z(z)) x, y, z in product(range(n), repeat=3)] 

Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -