Properties - when and why

Arthur Siegel ajs at ix.netcom.com
Mon Jul 8 08:41:23 EDT 2002


Alex writes -

>The obvious solution for this case is to keep your original
>get_V method intact and to code V_homogeneous the simple way:

>def V_homogenous(self):
>    V = self.V
>   return array((V.x,V.y,V.z,1.))


Thanks for the reply, and sorry for the various careless idiocies in my
post.

But your suggestion is exactly what I concluded to do in my own code
until I thought I concluded - and this is the gist of my question - that
even with the
syntax you suggest I was making now 4 calls to the vector subtract
calculation -
one for V= self.V and one each time I called for an attribute of V.

If I am wrong there - my problem essentially goes away. I was doing it in a
context of my code where there are many interrelationships and I may have
misintepreted what I was seeing.

Are you in fact saying that your suggested solution avoids multiple calls
to the calculation that determines the value of self.V?


Art






More information about the Python-list mailing list