Vector classes

Mizipzor mizipzor at gmail.com
Sun Apr 22 08:33:53 EDT 2007


During my coding Ive found two vector classes on the internet. Ive
modified them both a little but the do both have advantages and
disadvantages.

vector1: http://rafb.net/p/4FVdh699.html
vector2: http://rafb.net/p/0KShGu30.html

With 1, I can typ vec.x and vec.y, very nice. With 2, I need to do
vec.vals[0] and vec.vals[1], which makes my eyes bleed.

But with 2, I can create a vector by supplying a list of numbers as
arguments. And I can also do maths with numbers (ints/floats) and not
just vectors (something 1 forces me to do).

Is there any way to combine the two? The ultimate would be if I
somehow could take vector2 and hook the member self.vals[0] to self.x
or something.




More information about the Python-list mailing list