On 19 Nov 2005 05:29:07 -0800 "Gerard Flanagan" <[EMAIL PROTECTED]> wrote: > If I have the Vector class below, is there a means by > which I can have the following behaviour > > > >>>A = Vector(1, 2) > >>>print A > (1, 2) > >>>A = 0 > >>>print A > (0, 0)
As has already been mentioned, "A = 0" rebinds the name "A" to the object "0" so there's no way it can mutate the object A. However, you could create an object "Origin" to use as a vector zero: Origin = Vector(0,0) Or if you want to be shorter, more poetic, and make future maintainers curse you, you can call it "O": O = Vector(0,0) ;-) -- Terry Hancock ([EMAIL PROTECTED]) Anansi Spaceworks http://www.AnansiSpaceworks.com -- http://mail.python.org/mailman/listinfo/python-list