Suggestion for (re)try statement
Rocco Moretti
roccomoretti at hotpop.com
Fri Oct 28 10:23:34 EDT 2005
Sori Schwimmer wrote:
> 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
The gold standard for language syntax changes is "compelling use cases"
- if introduced, how often will the construct be used? Is there a python
program out there (preferably in the standard library) which would be
*markedly* improved by the change? What is so repugnant about the
equivalent, currently valid way of writing it? -- Hypothetical and
theoretical arguments don't carry much weight in the Python community
("Practicality beats purity" and all that.)
And remember - your goal isn't ultimately to convince me or someother
person on comp.lang.python, it's to convince Guido.
More information about the Python-list
mailing list