vwait in Python?

Peter Hansen peter at engcorp.com
Thu Mar 28 22:20:42 EST 2002


Steve Holden wrote:
> 
> "Ken Guest" <kwg at renre-europe.com> wrote: in message
> > So is there no way, short of a 2 line while statement, to have code
> > hang around until the value of some variable has been changed?
> >
> > I have tried using variations of the simple while statement, but they
> > only result in the application hanging (going into an infinite loop
> > no doubt).
> >
> Now you've explained the REAL problem, of course it's easier to see how to
> solve it.
[...] 
> Something else you haven't explained is whether the code which changes the
> variable's value is aware that there is another component waiting for it to
> change (in other words, are you working with code you can modify, or must
> you just wait for the value to change).

This being Python, I wonder if it isn't possible, with code "you can't modify",
to change the code anyway, by inserting an appropriate __setattr__() to 
monitor the change.

If nothing else, this thought is giving me some cool ideas related to 
mock objects and such in doing test-driven development...  hmm. :-)

-Peter



More information about the Python-list mailing list