[EMAIL PROTECTED] wrote:
> Kind people,
> Is there any way one can, within Python, intercept the act of
> assignment.  For instance, suppose that I was obsessed with
> FORTRAN II, and decided that I wanted to print a warning,
> or raise an exception any time someone assigned an int to a
> variable whose name did not start with i,j,k,l,m, or n.

This is not possible. Assignments in the form

name = value

(also called "binding a name") are not overloadable. As Roy Smith already noted,
assignments in the form

name.attribute = value
name[item] = value

are overloadable via __setattr__ and __setitem__.

Georg
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to