[Python-Dev] Chaining try statements: eltry? (original) (raw)

Thomas Lotze thomas at thomas-lotze.de
Thu Jul 7 10:38:33 CEST 2005


Guido van Rossum <gvanrossum at gmail.com> wrote:

I also notice that your only example is very repetitive, and would be better written as a loop, using Python's dynamic nature:

Sure, that's true for the example given. Getting other stuff into a form which allows for looping may require additional code.

But then, the example was intended to illustrate, not persuade. It's fine with me if you're determined that eltry is a bad (or at least not good enough) idea. I do wish for it occasionally, but that's true for a number of things.

Thinking about it some more, I find that a symmetry between statements which have an 'else' part would be appealing from an aesthetic point of view, which includes introduction of 'elfor' and 'elwhile' - or allowing for syntax like 'else if ...:' and 'else try:'. (It seems some people favour that anyway. OTOH, I undestand that introducing two-token constructs doesn't necessarily simplify parsing.) But I haven't encountered any use cases for that, so it's probably just idle musing.

--

Viele Grüße, Thomas



More information about the Python-Dev mailing list