kne / pybox2d-from-googlecode

Automatically exported from code.google.com/p/pybox2d
Other
0 stars 0 forks source link

b2Color and b2Vec2 should have iterator methods #20

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
It would be usefull because with that we could pass them to functions that
are not aware of box2d (ie with *vec). Also converting to list or tuple
would be simpler.
A simple way in python to make the iterator method would be:

__iter__ = lambda self: iter((self.x, self.y))

tuple(vec) and list(vec) would work with this.

Original issue reported on code.google.com by giorg...@gmail.com on 11 Mar 2009 at 11:42

GoogleCodeExporter commented 9 years ago
Excellent. I had been meaning to add this, but kept forgetting about it. I wish 
it
had made the last release. :) Thanks again!

Added in r187.

Original comment by sir...@gmail.com on 12 Mar 2009 at 12:56