[Pythonedu-wg] py-zero: simple loop syntax

Jurgis Pralgauskis jurgis.pralgauskis at gmail.com
Wed Jul 13 01:36:21 EDT 2016


When I try to teach Python to young kids,
the big obstacle is describing repetitions in simple way (esp. for turtle
graphics).

for a in range(4):
   ....

More py-zen would be

repeat 4:
    ....

I know some py-edu-environments have their hacks:
https://codecombat.com/ has "loop"  instead "while True"
http://reeborg.ca/reeborg.html  has the "repeat n" version

Also "repeat n" is used in Blockly
<https://blockly-games.appspot.com/turtle?lang=en&level=10> and Scratch
<https://wiki.scratch.mit.edu/wiki/Repeat_()_(block)>

Also scientific math env has kind of hack for  "range(a, b+1)" -- just
"[a..b]" (like in CoffeScript
<https://coffeescript-cookbook.github.io/chapters/syntax/for_loops>):
http://sagemath.wikispaces.com/Counters

***My ideas, how to implement this***

- IDE (plugin)  translates  "repeat" to "for.." on run,
  on errors it could translate stuff back to hide any mention of "for.." :)
  or after translation could leave a comment that it has been translated
from "repeat"

- PEP for even more edu-friendly Python: "py-zero" (with possibly more
stuff)? :)

-- 
Jurgis Pralgauskis
tel: 8-616 77613;
Don't worry, be happy and make things better ;)
http://galvosukykla.lt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pythonedu-wg/attachments/20160713/ad3aa41a/attachment.html>


More information about the Pythonedu-wg mailing list