Can you set a class instance's attributes to zero by setting theinstance to zero?

Fredrik Lundh fredrik at pythonware.com
Sat Nov 19 08:50:07 EST 2005


Gerard Flanagan 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

that operation rebinds A; it doesn't affect the Vector instance in any way.

more here:

    http://effbot.org/zone/python-objects.htm

</F> 






More information about the Python-list mailing list