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

Re: [pygame] vector type: mutable or immutable



Hi,

I'm against implementing both. I think it makes what should be a rather simple class overcomplicated. Imagine the zoo of class we would have:
Vector2d, Vector2dConst, IntVector2d IntVectro2dConst, Vector3d, ...

I think we should make up our minds and then sick with one.

And I have to add that even though I started off favoring mutable vectors I then remembered also running into the subtle bugs Brian mentioned. So now I'm leaning in the immutable direction.



Brian Fisher wrote:
I guess making both would be the most pythonic - python gives you both lists and tuples...

On Fri, May 1, 2009 at 11:04 AM, Jake b <ninmonkeys@xxxxxxxxx <mailto:ninmonkeys@xxxxxxxxx>> wrote:

    Could you make both? Default to mutable, and use VectorConst ( insert
    better name ) where needed.

           .offset = Vector3Const(1,2,3)
           .vel = Vector3( offset )

    (throw exception when you try to modify a const vector?)
    --
    Jake