Python Python Collections (2016, retired 2019) Dungeon Game Dungeon Entrance

Ewerton Luna
Ewerton Luna
Full Stack JavaScript Techdegree Student 14,084 Points

"It might make sense to be a tuple if you were doing a large grid, numbers and numbers of cells"

I don't understand this statement. Why would it make sense if you were doing a large grid? Wouldn't it also make sense for whatever length of the grid?

1 Answer

Steven Parker
Steven Parker
177,563 Points

You're right, that comment flys by without explanation. If Kenneth were still a teacher I'd tag him and ask what he meant by that.

As is, I will speculate that a tuple might offer efficiency advantages over a list that would become noticable when there were a very large number of items. But that's purely a guess.

Ewerton Luna
Ewerton Luna
Full Stack JavaScript Techdegree Student 14,084 Points

Thanks! It really might be it.

I was thinking about it and the only conclusion I came to is that for a very large grid, numbers and numbers of cells, there would have no need to add new cells to the grid. You could work with slices and make any smaller grid from the bigger one. In that case, CELLS could be a tuple, since you wouldn't be adding any more cells. But I'm also speculating haha.