Look at page 19 on how the loop syntax was used!  It was used just for
 "repeat n times" - really simple, (and with a trivial useless loop body).
 "while" is for a more complicated situation (in general) where there the
number of repetitions is controlled by a significant and flexible
condition.  Such loops (particularly with code to prepare for the next time
through the loop) are likely the most difficult for my students to
understand, but I am not convinced that it is because of the word keyword
used, but just because of the more complicated real situation.

Also the keywords were not tested when a definite collection of objects was
being iterated over, as opposed to a simple repetition or an artificial
sequence created just to repeat.  Then foreach sounds like a clear winner,
likely somewhat better than to shorter Python "for".

"while" and "for" require complicated additional syntax if you just want
"repeat n times".  The question then becomes whether adding special syntax
for a simple repetition complicates the overall learning situation more
than sticking with fewer keywords and depending on flexible synthesis, like
using "for" with "range" in Python.  This is the only thing I get out of
the looping section of the article.  I find the table very misleading.

Dr. Andrew N. Harrington
  Computer Science Department
  Graduate Program Director g...@cs.luc.edu
  Loyola University Chicago
  529 Lewis Towers, 111 E. Pearson St. (Downtown)
  417 Cudahy Science Hall (Rogers Park campus)
http://www.cs.luc.edu/~anh
Phone: 312-915-7982
Fax:    312-915-7998
ahar...@luc.edu (as professor, not gpd role)

On Fri, Oct 2, 2015 at 9:02 AM, David Handy <da...@handysoftware.com> wrote:

> On Thursday, October 1, 2015 4:50pm, "Andre Roberge" <
> andre.robe...@gmail.com> said:
>
>
> ...
>
>
> The best keywords (combining result from the two groups) are thought to
> include: repeat, again, loop, cycle
> The worst keywords are thought to include: foreach, while, echo,
> duplicate, for .... with "for" getting the worst result of all.
> Now that you mention it, I have hazy memories from > 30 years ago, when I
> was learning BASIC, of puzzling over the meaning of the FOR keyword and
> wondering why they chose that word. So I'm not surprised to see that on the
> list of difficult keywords.
> However, the WHILE keyword in BASIC was intuitive for me. So it surprises
> me to see that on their list of bad keywords.
> David H
>
_______________________________________________
Edu-sig mailing list
Edu-sig@python.org
https://mail.python.org/mailman/listinfo/edu-sig

Reply via email to