[Python-Dev] Chaining try statements: eltry? (original) (raw)
Tim Peters tim.peters at gmail.com
Thu Jul 7 20:48:53 CEST 2005
- Previous message: [Python-Dev] Chaining try statements: eltry?
- Next message: [Python-Dev] Chaining try statements: eltry?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
[Guido, on {for,while}/else] ...
The question remains whether Python would be easier to learn without them. And if so, the question would remain whether that's offset by their utility for experienced developers. All hard to assess impartially!
That's what I'm here for. I like loop "else" clauses, but have to admit that (a) I rarely use them; (b) most of the time I use them, my control flow is on the way to becoming so convoluted that I'm going to rewrite the whole function soon anyway; and, (c) I've often misread code that uses them, mentally attaching the "else" to a nearby "if" instead.
I also suspect that if they weren't in the language already, a PEP to introduce them would fail, because
still_looking = True
some loop:
if found it:
still_looking = False
break
if still_looking:
# what would have been in the "else" clause
is clear and easy to write without it.
- Previous message: [Python-Dev] Chaining try statements: eltry?
- Next message: [Python-Dev] Chaining try statements: eltry?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]