Weird problem ?

Dirk-Ulrich Heise hei at adtranzsig.de
Wed Aug 11 05:53:02 EDT 1999


Hi Mikael!

Besides the problem you asked for, your code has
the problem of looking a bit confusing:
>
>class VECTOR:

The following three lines make no sense,
or at least not the sense you had in mind,
i suspect:
Here, you set up three variables that
could be accessed with "VECTOR.x",
"VECTOR.y", "VECTOR.z" -
they don't belong to any instance.

>   x = 0.0
>   y = 0.0
>   z = 0.0

Now, you let each instance create
its own x,y,z (which is presumably what you
wanted to do):
>   def __init__(self,xx=0.0,yy=0.0,zz=0.0):
>      self.x = xx
>      self.y = yy
>      self.z = zz

You don't have to declare variables in Python.
the 3 lines under "class VECTOR" don't do what
you wanted them to, just delete them.
--
Dirk
Where did you want to go again?






More information about the Python-list mailing list