[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

hot-backup.py weird for-else clause

From: Stefan Sperling <stsp_at_elego.de>
Date: Mon, 1 Feb 2010 16:06:39 +0100

Hi,

consider this snippet from hot-backup.py.in:

  if retry:
    for delay in (0.5, 1, 2, 4):
      try:
        rmtree(dirname)
        break
      except:
        time.sleep(delay)
    else:
      rmtree(dirname)
  else:
    rmtree(dirname)

I don't think an 'else' clause to a for-loop makes any sense,
right? Is this a legal python construct I wasn't aware of,
or simply a mistake?

Proposed patch:

Index: hot-backup.py.in
===================================================================
--- hot-backup.py.in (revision 905260)
+++ hot-backup.py.in (working copy)
@@ -82,8 +82,6 @@
         break
       except:
         time.sleep(delay)
- else:
- rmtree(dirname)
   else:
     rmtree(dirname)
 
Stefan

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2443813

*** THIS LIST IS CLOSED ***
Please start new threads on the <dev_at_subversion.apache.org> mailing list.
To subscribe to the new list, send an empty e-mail to <dev-subscribe_at_subversion.apache.org>.
Received on 2010-02-01 16:06:59 CET

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.