[Python-ideas] Framework for Python for CS101

Andrew Barnert abarnert at yahoo.com
Tue May 26 22:32:08 CEST 2015


On May 26, 2015, at 11:19, Wes Turner <wes.turner at gmail.com> wrote:
> 
> Ways to teach Python from first principles:

What you're suggesting may be a reasonable way to restrict Python for teaching (although, as others have argued, I don't think it's necessary)--but it isn't a reasonable way to get what Rustom Mody says he wants.

While his first paragraph started out talking about restricting Python to a subset, only one of the four examples I've seen actually is a restriction. He wants procedures and functions to be fundamentally distinct things, defined differently and called differently. You can't do that by restricting the token list, or by using RPython instead of Python, or by executing code inside a container. And the one that actually _is_ a restriction isn't at the grammar level, it's just hiding a bunch of methods (list.append, presumably list.__setitem__, etc.).

Of course you _could_ do everything he wants by forking one of the Python installations and heavily modifying it (I even suggested how that particular change could be implemented in a CPython fork), or by writing a new Python-like language with a compiler that compiles to Python (which, at its simplest, might be reducible to a set of MacroPy macros or a source preprocessor), because you can do _anything_ that way. But then you're not really talking about Python in the first place, you're talking about designing and implementing a new teaching language that just borrows a lot of ideas from Python and is implemented with Python's help. And none of the rest of your suggestions are relevant once that's what you're doing.

> * Restrict the syntactical token list ("switch features on and off")
>   * Fork Python
>   * RPython -- https://rpython.readthedocs.org/en/latest/ 
>   * https://pypi.python.org/pypi/RestrictedPython
>   * http://pyvideo.org/video/2585/building-and-breaking-a-python-sandbox
>   * OR: execute code in container (e.g. LXC, LXD, Docker (JupyterHub); virtualization)
> 
> * Add a preprocessor with a cost function to limit valid tokens for a given code submission
>   (see the links to the Python grammar, tokenizer, compiler linked above)
> 
> * Modify nbgrader to evaluate submissions with such a cost function:
>   https://github.com/jupyter/nbgrader
> 
> * Receive feedback about code syntax and tests from a CI system with repository commit (web)hooks
>   * BuildBot, Jenkins, Travis CI, xUnit XML
>     https://westurner.org/wiki/awesome-python-testing#continuous-integration-ci-and-continuous-delivery-cd
> 
> 
> 
>> On Tue, May 26, 2015 at 1:56 AM, Andrew Barnert via Python-ideas <python-ideas at python.org> wrote:
>> On May 25, 2015, at 22:36, Rustom Mody <rustompmody at gmail.com> wrote:
>> >
>> > I am talking of a framework for a teacher to chart a course through python, not any changes per se to python itself.
>> 
>> How exactly can you allow a teacher to "chart a course through python" that includes separate function and generator function definition statements, procedures as distinct from functions, etc. without changing Python? Python doesn't have the configurability to switch those features on and off, and also doesn't have the features to switch on in the first place.
>> 
>> > A teacher wanting to chart a different course through python should be free (and encouraged) to do that as well.
>> 
>> 
>> I would like a framework for a teacher to chart a course through driving the Nissan 370Z that would allow me to start off teaching hoverpads instead of wheels, but a teacher wanting to chart a different course should be free to start with sails instead. And I want to do this without changing anything about the 370Z.
>> 
>> 
>> _______________________________________________
>> Python-ideas mailing list
>> Python-ideas at python.org
>> https://mail.python.org/mailman/listinfo/python-ideas
>> Code of Conduct: http://python.org/psf/codeofconduct/
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150526/58a584ab/attachment-0001.html>


More information about the Python-ideas mailing list