[Python-ideas] Simpler syntax for basic iterations

John Wong gokoproject at gmail.com
Sat Oct 10 00:36:20 CEST 2015


On Friday, October 9, 2015, Andre Roberge <andre.roberge at gmail.com> wrote:
>
>
> And, just to put things in perspective: I first wrote RUR-PLE in 2004 and
> have been working on tutorials for it, discussing with many teachers using
> it during all these years.  So, yes, I know I (and others) can make do
> without this special construct I am suggesting ... but at the cost of a
> larger hurdle for the students than would be required if the alternative
> construct existed.
>
>
But also at the cost of introducting new syntaxatic sugar which is
literally a few chars fewer,  at the expense of teaching and explain using
one or another, "longer standard" version and the shortcut, is not going to
make students more productive. I think in general people are smart enough
to make decision, recognize tricks. Time should spend on educating students
on writing code. This feels like micro optimization.

I would rather see
for key, value in mydict.items():
And
for index, element in enumerate(mylist)

to be sugar-coated. This is more annoying to type than the problem being
discussed. Everyone's mileage is different but I bet the use of items and
enumerate is too frequent and yet there is no briefer version.

And I also dont think repeat(..) is helpful for a few chars either. Nice to
show how to abstract user from detail implementation (e.g complex repeated
task).




-- 
Sent from Jeff Dean's printf() mobile console
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20151009/b41c95f2/attachment.html>


More information about the Python-ideas mailing list