On Sun, 2007-08-26 at 08:00 +0200, DR0ID wrote:
Hi
sure, tuples are hashable and if it brakes the API thne forget my patch.
But then the documentation must be more clear about what to put there
in! (a small example perhaps?) Because the simple assumption is a Rect
object (which can not work as key). I though a bit about when you would
use a dict to store rect/sprite (or whatever) pairs and then check for
collision. I think it is not that useful (because if you use a
rect/sprite pair, the rect has to be updated manually if it changes in
the sprite).
The 1.7 documentation is pretty clear about what you need to do,
Remember python dictionary keys must be immutable, Rects are not
immutable, so they cannot directly be, dictionary keys. You can
convert the Rect to a tuple with the tuple() builtin command.
Tim Ansell