"KraftDiner" <[EMAIL PROTECTED]> writes: > Well I guess what I'm trying to achive is the invalidate the instance > of the object. > I have been using None to denote an invalide or uninitialized instance > of an object. > > There is a degenerate case in my code where a polygon has less than 3 > points and > I want to class to flag this instance of the object as invalid. > > so.. like super.self = None :)
You're running headlong into the fact that Python's variables are just ways to reference objects - "names" if you will - and not objects themselves. Whe you write "foo = some_obj", all you're doing is making tha name "foo" refer to some_obj instead of to whatever it was referring to before. Neither some_obj nor the object previously known as "foo" are changed in anyway. To make a change in the object, you have to make a change in the object proper, not just a name that refers to it. Adding a flag that clients can test to see if the object is still valid would do it. Changing the operations that clients do on the object so they raise exceptions will also work, and might be considered more Pythonic. <mike -- Mike Meyer <[EMAIL PROTECTED]> http://www.mired.org/home/mwm/ Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information. -- http://mail.python.org/mailman/listinfo/python-list