How to let a loop run for a while before checking for break condition?

Discussion in 'Python' started by Sorin Schwimmer, Aug 28, 2006.

  1. to Fredrik Lundh
    I'm afraid Claudio Grondi can't use your solution, as
    he needs it hosted on Windows, which lacks
    signal.alarm.

    to Claudio Grondi
    How about splitting your loop in two? The first loop
    would check for your boolean, which is changed by your
    timer, the second loop will check for your "normal"
    exit condition?

    Sorin

    __________________________________________________
    Do You Yahoo!?
    Tired of spam? Yahoo! Mail has the best spam protection around
    http://mail.yahoo.com
     
    Sorin Schwimmer, Aug 28, 2006
    #1
    1. Advertisements

  2. Sorin Schwimmer wrote:
    > to Fredrik Lundh
    > I'm afraid Claudio Grondi can't use your solution, as
    > he needs it hosted on Windows, which lacks
    > signal.alarm.
    >
    > to Claudio Grondi
    > How about splitting your loop in two? The first loop
    > would check for your boolean, which is changed by your
    > timer, the second loop will check for your "normal"
    > exit condition?

    I don't understand your proposal. Do you mean using another thread?
    I suppose, that wxPython provides something like what I am looking for,
    but using it only to speed up a Python loop is sure not an option.
    Concluding from lack of responses related to a Windows version of
    Fredriks solution I suppose, that there is no way to achieve it with
    standard Python on Windows.

    Claudio Grondi
     
    Claudio Grondi, Aug 28, 2006
    #2
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Steven

    while loop in a while loop

    Steven, Mar 24, 2005, in forum: Java
    Replies:
    5
    Views:
    2,499
    Tim Slattery
    Mar 30, 2005
  2. -
    Replies:
    12
    Views:
    976
    Remon van Vliet
    Jun 15, 2005
  3. Claudio Grondi
    Replies:
    16
    Views:
    595
    Matimus
    Aug 30, 2006
  4. Sorin Schwimmer
    Replies:
    2
    Views:
    351
    Steve Holden
    Aug 29, 2006
  5. Uday Bidkar
    Replies:
    4
    Views:
    727
    =?ISO-8859-15?Q?Juli=E1n?= Albo
    Dec 12, 2006
  6. Ulrich Eckhardt
    Replies:
    5
    Views:
    393
    Gregory Ewing
    Feb 25, 2010
  7. Bill W.
    Replies:
    13
    Views:
    556
    Phillip Gawlowski
    May 9, 2011
  8. Isaac Won
    Replies:
    9
    Views:
    776
    Ulrich Eckhardt
    Mar 4, 2013
Loading...