vwait in Python?
jeff at ccvcorp.com
Thu Mar 28 20:05:42 CET 2002
Ken Guest wrote:
> On Thu, 2002-03-28 at 11:37, Ken Guest wrote:
> > Anybody know if there's an equivalent to TCL's vwait keyword in Python?
> 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).
You *could* make this work by using threads, but it's likely that there's a
more effective way of solving the real problem. You could also require that
the variable in question be changed through some proxy object, and have that
proxy automatically execute some code (either hardcoded in or registered with
the proxy at runtime) when the variable changes. (This could be done either
by using an explicit setter method, or by use of proxy.__setattr__(). )
(By the way, being impatient for a response after only 4 hours, on Usenet, is
kind of silly. Netnews can be slow to propagate, many people only read at
particular times of day, etc, etc... I'd recommend waiting at least a day or
three before you start presuming that nobody will answer.)
More information about the Python-list