[Python-Dev] PEP 340: Breaking out.

Skip Montanaro skip at pobox.com
Tue May 3 17:30:53 CEST 2005


>>>>> "Pierre" == Pierre Barbier de Reuille <pierre.barbier at cirad.fr> writes:

    Pierre> Tom Rothamel a écrit :
    >> I have a question/suggestion about PEP 340.
    >> 
    >> As I read the PEP right now, the code:
    >> 
    >> while True:
    >>     block synchronized(v1):
    >>	       if v1.field:
    >>	           break
    >>     time.sleep(1)
    >> 
    >> Will never break out of the enclosing while loop.

    Pierre> Well, that's exactly what it is intended to do and what I would
    Pierre> expect it to do ! break/continue affect only the inner-most
    Pierre> loop.

Yeah, but "block synchronized(v1)" doesn't look like a loop.  I think this
might be a common stumbling block for people using this construct.

Skip


More information about the Python-Dev mailing list