[Python-ideas] Framework for Python for CS101

John Wong gokoproject at gmail.com
Mon May 25 21:48:18 CEST 2015


The title is very catchy :-) I am genuinely interested in improving CS
education, both from the perspective of a recent grad and a learner in
general (who isn't?). But I think we all do appreciate every effort this
community put together as a whole.

> One of the things we would like to try is a framework for CS101 [Intro to
programming]
I am still unsure what kind of framework we are proposing. What is the
exact goal? Is it just teaching more FP? Benefit? What are the user
stories? Maybe this is not something people would integrate into CPython,
and probably something you'd fork from CPython.

>From my experience, the hard thing about learning a new programming
language is not always about undefined behaviors, under-documented APIs or
confusing syntax, but sometimes the lack of documentation demonstrating how
to effectively use the language and leverage community tools frustrate
people. Python community is extremely supportive and there is so many info
out there that a search would yield some useful answer right away. For some
other languages that is not that case. But Python can do better, and I feel
this is the issue with learning a language more effective. Teaching syntax,
or understand how to model your problem before you crack a solution are
secondary IMO. I as a learner is far more interested in "how do I
accomplish XYZ" and then I will get curious about how one come to a
particular solution. Similarly, when I see beautiful Vim setup I would go
look for "how to setup my Vim like this."

I say all the above because, IMO, OO vs FP, Scheme vs Python vs Java vs C
is really not an interesting debate. I am biased because the first language
I was taught officially in my undergraduate career was Python (but I knew
basic programming well before that). I appreciate the expressive of FP, and
how FP "supposedly" help reason your solution, much closer how you would
write a proof. But with all due respect, I don't think FP vs OO is really
the problem in CS 101, or just about any one learning a new language.

Teachers (including TAs) would have to spend time to get a Python setup
working on each student's workstation, or troubleshoot environmental issue
(to be fair, this is part of learning dealing with different platform,
different toolsets). Hence I love projects which aim to reduce
administrative tasks in classroom (ipython notebook, online
compiler/interpreter etc).

Or maybe more verbose warning for beginners? For example, there was a PEP
(???) to add a warning when someone type (print "hello world") in Python 3
instead of showing invalid syntax. That can be extremely helpful for
beginners and this is something worth thinking. For example, certain errors
/ deprecations could show "refer to this awesome PEP, or refer to this
interesting discussion, or refer to this really well-written blogpost -
something python core-dev agrees with."

Thanks.

John

On Mon, May 25, 2015 at 2:33 PM, Wes Turner <wes.turner at gmail.com> wrote:

>
>
> On Mon, May 25, 2015 at 7:11 AM, Rustom Mody <rustompmody at gmail.com>
> wrote:
>
>>
>> On Monday, May 25, 2015 at 1:31:58 PM UTC+5:30, Andrew Barnert via
>> Python-ideas wrote:
>>>
>>> On May 24, 2015, at 22:06, Rustom Mody <rusto... at gmail.com> wrote:
>>>
>>> Context:  A bunch of my students will be working with me (if all goes
>>> according to plan!!)to hack on/in CPython sources.
>>>
>>> One of the things we would like to try is a framework for CS101 [Intro
>>> to programming]
>>>
>>> So for example beginners get knocked out by None 'disappearing' from the
>>> prompt
>>> Correctable by
>>>
>>> >>> import sys
>>> >>> sys.displayhook = print
>>>
>>> Now of course one can say: "If you want that behavior, set it as you
>>> choose"
>>> However at the stage that beginners are knocked down by such, setting up
>>> a pythonstartup file is a little premature.
>>>
>>> So the idea (inspired by Scheme's racket) is to have a sequence of
>>> 'teachpacks'.
>>> They are like concentric rings, the innermost one being the noob ring,
>>> the outermost one being standard python.
>>>
>>>
>>> How exactly does this work? Is it basically just a custom pythonstartup
>>> file that teachers can give to their students? Maybe with some menu- or
>>> wizard-based configuration to help create the file? Or is this some
>>> different mechanism? If so, what does setting it up, and distributing it to
>>> students, look like?
>>>
>>
>> Frankly Ive not thought through these details in detail(!)
>>
>>
>>> I realize that below you talk about doing things that are currently not
>>> easy to do in a pythonstartup, like hiding all mutating sequence methods,
>>> but presumably the patches to the interpreter core would be something like
>>> adding hide_mutating_sequence_methods() and similar functions that teachers
>>> could then choose to include in the pythonstartup file or whatever they
>>> give out.
>>>
>>>
>> I personally would wish for other minor surgeries eg a different keyword
>> from 'def' for generators.
>> From the pov of an experienced programmer the mental load of one keyword
>> for two disparate purposes is easy enough to handle and the language
>> clutter from an extra keyword is probably just not worth it.
>> However from having taught python for 10+ years I can say this
>> 'overloading' causes endless grief and slowdown of beginners.
>>
>
> * https://docs.python.org/2/library/tokenize.html
> * https://hg.python.org/cpython/file/2.7/Lib/tokenize.py
> * https://hg.python.org/cpython/file/tip/Grammar/Grammar
> *
> https://www.youtube.com/watch?v=R31NRWgoIWM&index=9&list=PLt_DvKGJ_QLZd6Gpug-6x4eYoHPy4q_kb
>
> * https://docs.python.org/devguide/compiler.html
> * https://docs.python.org/2/library/compiler.html
>
> I identify functions that are generators by the 'yield' (and 'yield from')
> tokens.
>
> I document functions that yield:
>
> def generating_function(n):
>     """Generate a sequence
>     # numpy style
>     :returns: (1,2,..,n)
>     :rtype: generator (int)
>
>     # google-style
>     Yields:
>         int: (1,2,n)
>
>     """
>     returns (x for x in range(n))
>
>
>
>
>> Then there is even more wishful thinking changes -- distinguishing
>> procedure from function.
>> After 30 years of Lisp and ML and ... and Haskell and
>> square-peg-into-round-holing these into python, Ive come to the conclusion
>> that Pascal got this distinction more right than all these.  However I
>> expect this surgery to be more invasive and pervasive than I can handle
>> with my (current) resources.
>>
>
> @staticmethod, @classmethod, @property decorators
>
>
>> etc
>> etc
>> In short I am talking of a language that is morally equivalent to python
>> but cosmetically different and is designed to be conducive to learning
>> programming
>>
>
> I suppose you could fork to teach; but [...].
>
> You might check out http://pythontutor.com/ and/or
> http://www.brython.info/ (Python, JS, and compilation).
>
>
>>
>>
>> _______________________________________________
>> 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/
>>
>
>
> _______________________________________________
> 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/20150525/81fe9b9b/attachment.html>


More information about the Python-ideas mailing list