[Python-Dev] Chaining try statements: eltry?

Josiah Carlson jcarlson at uci.edu
Thu Jul 7 20:35:01 CEST 2005


Guido van Rossum <gvanrossum at gmail.com> wrote:
> 
> On 7/7/05, François Pinard <pinard at iro.umontreal.ca> wrote:
> > [Guido van Rossum]
> > 
> > > I even wonder if else-clauses on for/while were a good idea.
> > 
> > I surely find them useful, and see them as a Python originality (a
> > welcome one).
> 
> They are indeed an original invention. (One day I looked at the
> similarity between if and while and noticed that there was a use case
> for else after while too.)
> 
> 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!

(data point)

I had gotten along for 5 years without knowing/remembering there existed
an else clause in for and while loops until the beginnings of the
thunk/block/with discussion in February or March.  Commercial work puts
me at around 30k lines of Python in the last year.  In the last 3-4
months, I've used the else clause on for and while around 5 times.

In looking at the tutorial, I notice that else clauses on loops is
discussed a few sections after discussion on the loops themselves.  This
seems like a reasonable location to me, though to be sure, we should
find some people, get them to learn Python through the tutorial, then
ask them what they thought of the tutorial on else clauses in for and
while loops, and whether or not they confused them.

 - Josiah



More information about the Python-Dev mailing list