On Friday, September 30, 2016 at 2:16:10 PM UTC-4, Les Cargill wrote: > A really interesting design approach in Tcl is to install a callback > when a variable is written to. This affords highly event-driven > programming. > > Example ( sorry; it's Tcl ) : > >
(I can't read Tcl, sorry) > > What is an equivalent mechanism in Python? There's no way* to hook into "x = 2", but you could hook into "x.a = 2" if you wanted do, by defining __setattr__ on x's class. *OK, there might be some crazy hack involving your own class as the globals for a module or something, but it sounds ill-advised. --Ned. -- https://mail.python.org/mailman/listinfo/python-list