Have you ever noticed that the coordinates for row and column are in the reverse order of x and y coordinates?
I did not notice this until recently. Suppose you have a chart divided into rows and columns. We typically give the row first and then the column. If someone asks what is in position (2,5) we go up to the second row and then across to the fifth column. In the (x,y) system, we move 2 spaces horizontally for x and then 5 spaces up for y.
Observing members:
0
Composing members:
0
5 Answers
That my friend is off the charts.
I always followed the cartesian coordinate system invented by René Descartes.
Wow! I hadn’t noticed! Both systems are so ingrained and intuitve to me I did not see it.
Yes… well, who does row first and then column? I don’t, but if/when someone does, it does bug me, because I am used to x, y and because I have done a lot of 2D programming using x, y.
It also bothers me when 3D graphics systems use x, y, z and they assign Y to “up” – drives me nuts.
@Zaku , In Python a two dimensional array is a one dimensional array of one dimensional arrays. The inner one dimensional arrays are referred to as rows. array[2][5] refers to the fifth element in the second row (actually the third element of the sixth row due to zero based indexing). It makes perfectly good sense. If you print out array[n] for each member of the array. you get a printout one row at a time, so the Python rows are rows in the printout.
Yes, that makes sense in that context, though that context is a different thing from spatial coordinates. It does make it inconveniently backwards if you are trying to program a game where an array of arrays is supposed to represent a world map, but only if you are planning to use do something like print array[x] and are going to be confused by it printing in a horizontal line.
Python terming the first array a “row” is also unfortunate if you want to use such an array as WorldMap[x][y] and not get confused by thinking of them as rows.
Answer this question