<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, May 25, 2015 at 7:11 AM, Rustom Mody <span dir="ltr"><<a href="mailto:rustompmody@gmail.com" target="_blank">rustompmody@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><br>On Monday, May 25, 2015 at 1:31:58 PM UTC+5:30, Andrew Barnert via Python-ideas wrote:<span class=""><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="auto"><div>On May 24, 2015, at 22:06, Rustom Mody <<a rel="nofollow">rusto...@gmail.com</a>> wrote:</div><div><br></div><blockquote type="cite"><div><div dir="ltr"><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div></div>Context:  A bunch of my students will be working with me (if all goes according to plan!!)to hack on/in CPython sources. <br></div><br></div>One of the things we would like to try is a framework for CS101 [Intro to programming]<br><br></div>So for example beginners get knocked out by None 'disappearing' from the prompt<br></div>Correctable by<br><br>>>> import sys
<br>>>> sys.displayhook = print
<br><br></div>Now of course one can say: "If you want that behavior, set it as you choose"<br></div>However at the stage that beginners are knocked down by such, setting up a pythonstartup file is a little premature.<br><br></div>So the idea (inspired by Scheme's racket) is to have a sequence of 'teachpacks'.<br></div>They are like concentric rings, the innermost one being the noob ring, the outermost one being standard python.<br></div></div></div></div></div></div></div></div></div></div></blockquote><div><br></div>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? <span style="background-color:rgba(255,255,255,0)">Or is this some different mechanism? If so, what does setting it up, and distributing it to students, look like?</span></div></blockquote></span><div><br>Frankly Ive not thought through these details in detail(!) <br></div><span class=""><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="auto"><div></div><div>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.</div><div><br></div></div></blockquote></span><div><br>I personally would wish for other minor surgeries eg a different keyword from 'def' for generators.<br>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.<br>However from having taught python for 10+ years I can say this 'overloading' causes endless grief and slowdown of beginners.<br></div></div></blockquote><div><br></div><div>* <a href="https://docs.python.org/2/library/tokenize.html">https://docs.python.org/2/library/tokenize.html</a></div><div>* <a href="https://hg.python.org/cpython/file/2.7/Lib/tokenize.py">https://hg.python.org/cpython/file/2.7/Lib/tokenize.py</a></div><div>* <a href="https://hg.python.org/cpython/file/tip/Grammar/Grammar">https://hg.python.org/cpython/file/tip/Grammar/Grammar</a><br></div><div>* <a href="https://www.youtube.com/watch?v=R31NRWgoIWM&index=9&list=PLt_DvKGJ_QLZd6Gpug-6x4eYoHPy4q_kb">https://www.youtube.com/watch?v=R31NRWgoIWM&index=9&list=PLt_DvKGJ_QLZd6Gpug-6x4eYoHPy4q_kb</a> </div><div>* <a href="https://docs.python.org/devguide/compiler.html">https://docs.python.org/devguide/compiler.html</a></div><div>* <a href="https://docs.python.org/2/library/compiler.html">https://docs.python.org/2/library/compiler.html</a></div><div><br></div><div>I identify functions that are generators by the 'yield' (and 'yield from') tokens.</div><div><br></div><div>I document functions that yield:</div><div><br></div></div></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div class="gmail_extra"><div class="gmail_quote"><div>def generating_function(n):</div></div></div><div class="gmail_extra"><div class="gmail_quote"><div>    """Generate a sequence</div></div></div><div class="gmail_extra"><div class="gmail_quote"><div>    # numpy style</div></div></div><div class="gmail_extra"><div class="gmail_quote"><div>    :returns: (1,2,..,n)</div></div></div><div class="gmail_extra"><div class="gmail_quote"><div>    :rtype: generator (int)</div></div></div><div class="gmail_extra"><div class="gmail_quote"><div><br></div></div></div><div class="gmail_extra"><div class="gmail_quote"><div>    # google-style</div></div></div><div class="gmail_extra"><div class="gmail_quote"><div>    Yields:</div></div></div><div class="gmail_extra"><div class="gmail_quote"><div>        int: (1,2,n)</div></div></div><div class="gmail_extra"><div class="gmail_quote"><div><br></div></div></div><div class="gmail_extra"><div class="gmail_quote"><div>    """</div></div></div><div class="gmail_extra"><div class="gmail_quote"><div>    returns (x for x in range(n))</div></div></div></blockquote><div class="gmail_extra"><div class="gmail_quote"><div><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div><br>Then there is even more wishful thinking changes -- distinguishing procedure from function.<br>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.<br></div></div></blockquote><div><br></div><div>@staticmethod, @classmethod, @property decorators</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div>etc<br>etc<br>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</div></div></blockquote><div><br></div><div>I suppose you could fork to teach; but [...].</div><div><br></div><div>You might check out <a href="http://pythontutor.com/">http://pythontutor.com/</a> and/or <a href="http://www.brython.info/">http://www.brython.info/</a> (Python, JS, and compilation).</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><br></div><br>_______________________________________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org">Python-ideas@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-ideas" target="_blank">https://mail.python.org/mailman/listinfo/python-ideas</a><br>
Code of Conduct: <a href="http://python.org/psf/codeofconduct/" target="_blank">http://python.org/psf/codeofconduct/</a><br></blockquote></div><br></div></div>