[Python-ideas] Nudging beginners towards a more accurate mental model for loop else clauses

Antoine Pitrou solipsis at pitrou.net
Fri Jun 8 16:55:17 CEST 2012

Le 08/06/2012 11:04, Nick Coghlan a écrit :
> The only thing I'm trying to do with the tutorial update is to
> encourage beginners to be start thinking in terms of try/except/else
> when they first encounter for/break/else and while/break/else. That's
> it.

I don't see why you're trying to draw that analogy, since a loop has 
nothing in common with a try block. For the record, when I was a Python 
beginner, I had zero problem understanding the for/else construct, and 
it even struck me as very useful ("oh, they've thought about a clean and 
easy way to write search-and-break loops").

I don't think it's useful to think of beginners as people having 
comprehension problems. Besides, if you don't understand something up 
front, there's always the possibility to come back later.



More information about the Python-ideas mailing list