Suggestion for (re)try statement
- From: Sori Schwimmer <sxn02@xxxxxxxxx>
- Date: Thu, 27 Oct 2005 13:10:39 -0700 (PDT)
Hi,
I think that would be useful to have an improved
version of the "try" statement, as follows:
try(retrys=0,timeout=0):
# things to try
except:
# what to do if failed
and having the following semantic:
for i in range(retrys):
try:
# things to try
except:
if i < retrys:
i += 1
sleep(timeout)
else:
# what to do if failed
else:
break
Of course, "break" may be the last statement in the
"try" branch, and "try"'s "else" may be ommited
completely.
Can't think of a syntax to keep it look like a
statement rather than a function.
Opinions? Is it worth for a PEP?
Sorin
__________________________________
Yahoo! FareChase: Search multiple travel sites in one click.
http://farechase.yahoo.com
.
- Prev by Date: Re: MSH (shell)
- Next by Date: How to replace all None values with the string "Null" in a dictionary
- Previous by thread: Re: Double replace or single re.sub?
- Next by thread: How to replace all None values with the string "Null" in a dictionary
- Index(es):
Relevant Pages
|
|