"glomde" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
| In a class it is poosible to override setattr, so that you can decide
| how you should
| handle setting of variables.
|
| Is this possible to do outside of an class on module level.
|
| mysetattr(obj, var, value):
|  print "Hello"
|
| So that
|
| test = 5
|
|
| would print
| Hello

An assignment at module level amounts to setting an attribute of an 
instance of the builtin (C coded) module type, which you cannot change. 
Even if you can subclass that type (I don't know), there is no way to get 
the (stock) interpreter to use instances of your module subclass instead. 



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

Reply via email to