[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Storing images in a list



Chris wrote:
The image is assigned like...

red_stone = game_image ("red_stone.png")

Later, it goes into the list like...

board_layout.append ([red_stone, (x, y)...])

So is a copy of red_stone in the list or just a pointer?

That particular question can be answered based on the
principles of the Python language. Any statement of the
form

  a = [b]

will only ever put a reference to whatever b currently
refers to into the list. There is no way that statement
can, on its own, cause the object referred to by b to be
copied.

--
Greg