improper position of continue?

Rob Hooft rob at hooft.net
Wed Aug 2 08:24:11 EDT 2000


no203[146]~%3% python
Python 2.0b1 (#31, Aug  2 2000, 10:19:01)  [GCC egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)] on linux2
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
Copyright 1995-2000 Corporation for National Research Initiatives (CNRI)
>>> while 1:
...    try:
...      continue
...    finally:
...      pass
... 
SyntaxError: 'continue' not properly in loop (line 3)
>>> 

Why? 


I was attempting this in a setting like:

while 1:
    os.chdir('subdir')
    try:
       [stuff with continue]
    finally:
       os.chdir('..')

Regards,

Rob
-- 
=====   rob at hooft.net          http://www.hooft.net/people/rob/  =====
=====   R&D, Nonius BV, Delft  http://www.nonius.nl/             =====
===== PGPid 0xFA19277D ========================== Use Linux! =========



More information about the Python-list mailing list