Running code on assignment/binding
David Hirschfield
davidh at ilm.com
Tue Jun 20 14:46:27 EDT 2006
Another deep python question...is it possible to have code run whenever
a particular object is assigned to a variable (bound to a variable)?
So, for example, I want the string "assignment made" to print out
whenever my class "Test" is assigned to a variable:
class Test:
...
x = Test
would print:
"assignment made"
Note that there's no "()" after x = Test, I'm not actually instantiating
Test, just binding the class to the variable "x"
Make sense? Possible?
-David
--
Presenting:
mediocre nebula.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20060620/0ab13aa4/attachment.html>
More information about the Python-list
mailing list