jiffyclub / ipythonblocks

Practice Python with colored grids in the IPython Notebook
http://ipythonblocks.org
Other
157 stars 58 forks source link

confusing indexing #38

Open lepmik opened 5 years ago

lepmik commented 5 years ago

Hi!

First of all, love this project! Using it to teach matrix indexing, and finally simulate and animate an epidemic.

One thing I find a bit confusing though is your choice of indexing which is different from numpy e.g.

grid = BlockGrid(20, 10, block_size=4)
print(grid.shape)
>>> (20, 10)
grid[9, 19]

As opposed to numpy

grid = np.zeros((20,10))
print(grid.shape)
>>> (20, 10)
grid[19, 9]
lepmik commented 5 years ago

To clarify, it's the shape output I'm confused about, i.e. that grid.shape[0] is the number of columns