On 10/12/2015 1:35 AM, Serhiy Storchaka wrote:
On 10.10.15 05:29, Terry Reedy wrote:
Reconceptualizing for beginners...
Many people working with kids have asked for various changes to Python
in order to make it easier for kids, sometimes very young. Some
variations have been requested more than once.
1. Simple looping: 'repeat/do/loop/for n [times]:' (take your pick of
keyword) versus 'for i in range(n):'.
The latest request is by Andre Roberge, today on python-ideas, in
"Simpler syntax for basic iterations". This inspired me to write this
post. The education hook he offered is that the variation eliminates
the need for a loop variable in a context where variables are not
otherwise used. He has worked on robot programming for kids.
2. Simple function call: 'move 3', 'turn 90' (Logo, I believe) versus
'move(3)' 'turn(90)' (Turtle).
3. Simple Native language keywords. String-within-code translation is
not suited for this.
These are all things I think are wrong for Python itself but possibly
right for various learning situations. For 18 years I have watched
people try to change Python in ways like the above, when I think the
energy would be better directed to writing good quality translation
functions.
Part of my motivation for the idea is that Mark and I are working on
rewriting and substantially improving IDLE. If and when we succeed, it
would make even more sense to reuse it for related jobs than it does now.
Please don't touch IDLE. At least while it is a part of Python. IDLE is
*Python's* Integrated Development and Learning Environment, not Logo's,
and shouldn't learn non-Python syntax.
I was not and am not proposing to deliver IDLE with anything
non-standard. I was only suggesting the possibility of slightly
simplifying the current ability to customize IDLE. Python already comes
with sys.displayhook, which can be used to arbitrarily change output.
IDLE already comes with an extension hook that can be used to manipulate
input. Reformatting string and comment paragraphs is one example
(ReformatParagraph.py). Running the code in the editor is another
(ScriptBinding.py). A modified version of ScriptBinding could do any of
the above.
My specific idea was to add a hook to the ScriptBinding to optionally
call a translation function just before compiling. Thinking about it
now, there is hardly any need to do so.
A Stackoverflow question prompted me to think about this more.
https://stackoverflow.com/questions/34382144/changing-number-representation-in-idle
The OP wants to use interactive python, in particular IDLE's Shell, as a
calculator that can change the number base. The output part can be done
with sys.displayhook and an extension to install menu items. The input
part could be done by re-writing ScriptBinding or writing a separate
extension that re-writes on demand.
In the course of working this out, I realized that if I wrote a patch to
make use of a translator easier, I would disable translation when
running a .py, .pyw, or .pyo file or when the interactive prompt is
'>>>'. If I hear of anyone else doing something like this, I would
request following the same restriction. I agree that code marked as
'python' should be standard Python syntax and interpreted with standard
semantics.
--
Terry Jan Reedy
_______________________________________________
IDLE-dev mailing list
IDLE-dev@python.org
https://mail.python.org/mailman/listinfo/idle-dev