Vector classes

Erik Max Francis max at
Sun Apr 22 22:53:04 CEST 2007

Mizipzor wrote:

> 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:
> vector2:
> 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.

There are also full-featured Vector and Matrix classes in the 
module of ZOE:

Erik Max Francis && max at &&
  San Jose, CA, USA && 37 20 N 121 53 W && AIM, Y!M erikmaxfrancis
   Stretch a bow to the very full, / And you will wish you had stopped
    in time. -- Laotse, ca. 6th C. BC

More information about the Python-list mailing list