From kirby.urner at gmail.com Mon Nov 14 10:57:23 2016 From: kirby.urner at gmail.com (kirby urner) Date: Mon, 14 Nov 2016 07:57:23 -0800 Subject: [Edu-sig] interview with Kirby Urner (PyDev of the Week series) Message-ID: I'm sharing more biographical info so we keep getting to know one another better: http://www.blog.pythonlibrary.org/2016/11/14/pydev-of-the-week-kirby-urner/ My thanks to Mike Driscoll of Mouse vs. Python for putting this together. The article talks about my coming to Python thanks to my interest in geometry.[1] I don't go in to the specifics of that geometry in the interview, but have on edu-sig.[2] Kirby Urner Portland, Oregon [1] similar story as my friend the late Arthur Siegel, likewise crazy about geometry: http://www.4dsolutions.net/ocn/pygeo.html [2] and of course in my blogs e.g. just yesterday: http://mybizmo.blogspot.com/2016/11/planning-ahead.html -------------- next part -------------- An HTML attachment was scrubbed... URL: From kirby.urner at gmail.com Mon Nov 21 20:39:13 2016 From: kirby.urner at gmail.com (kirby urner) Date: Mon, 21 Nov 2016 17:39:13 -0800 Subject: [Edu-sig] Python + JS == more than their sum() Message-ID: I'm continuing to advance the notion, in Medium comments and elsewhere, that learning one computer language at a time may be less efficient than tackling two or more, but with a "main one" front burner. [1] I credit the LEX Institute for this idea.[2] The theory being: contrasts and comparisons help concepts stick, whereas just one example (of a language, human or computer) provides less traction, a slipperier slope. Like learning the J language (jsoftware.com) even a little helps one realize how different languages can be, bringing Python into sharper relief against a background. But J (of APL heritage) might be too exotic as a #2, why not do JavaScript? Python + JS could be as common as HTML + CSS. That's a little self serving as a common bootcamp design if JS front end, Python back end. Our PDX Code Guild in Portland takes that tack. The curriculum, then, would continually bring them together to discuss their similarities and differences. Either one could be foreground first, with the other as background, but we'd do a lot of jumping back and forth (and not just with JSON :-D). A breakthrough realization I had earlier today was that Jupyter Notebooks already gives me a JavaScript interpreter, even when my main kernel is Python 3. %%javascript at the top of any cell creates a node-like experience, and I'm able to write ES6 (JavaScript) with classes, arrow functions and everything. It feels a lot like using node --harmony testfile.js on cloud9 (another learning platform I visit). Here's an example, of a Jupyter Notebook running through nbviewer, with both Python and JS code cells. The point is to show off the similarities. https://goo.gl/nj9RPO Kirby Useful tools: http://codepen.io/ http://jsbin.com/ [1] https://goo.gl/U4Yx6l (comment on one of Quincy Larson's, about which language to learn first) [2] 'Who Is Fourier?' (one of its pubs) appears way back in edu-sig. Jason Cunliff and I met and talked about it in New York that time. Here's one of Jason's from 2002: https://mail.python.org/pipermail/edu-sig/2002-September/002255.html -------------- next part -------------- An HTML attachment was scrubbed... URL: From kirby.urner at gmail.com Tue Nov 22 13:06:05 2016 From: kirby.urner at gmail.com (kirby urner) Date: Tue, 22 Nov 2016 10:06:05 -0800 Subject: [Edu-sig] Python + JS == more than their sum() Message-ID: Wow, thank you Kevin and Wes for some eye-opening contributions! I really welcome their mind-expanding potential and have been diving into demos and docs all morning. [1] In my course last night we looked at that Jupyter Notebook comparing ES6 and Python scripts [2] and I also showed them how Python may be used to write HTML + CSS for browser rendering.[3] Output: https://flic.kr/p/PjQ6Bg (screen shot). Some of my students are beginner programmers, with little to no programming background so we're really just going over the basics, but at the same time we need to tune in the ecosystem with is typically a combination of Python + HTML + CSS + JS + SQL + regex at least. I use sqlite3 module for the SQL part, re module for regex. What we have in these resources though is something even more ambitious, including the ability to compile Python to JS! Wow. You know what they say: JS is the assembly language of the web. Even developers using JS full stack use transpilers to go from future JS -> past JS (using Babel mostly). Future JS (from where we stand now) is what looks more Python-like than ever. My current mode of teaching is to have students install the Anaconda distro and then to extend the library with the requests and flask modules for exploring web stuff. Anaconda includes command line conda for using in place of pip, to get packages from a large web of repositories. Now I see conda lets me install mpld3 to my Mac with no issues. mackurner:~ kurner$ conda install mpld3 My teaching application is here: thekirbster.pythonanywhere.com Kirby [1] Kevin, http://pyeverywhere.org/docs/ 404s [2] https://github.com/4dsolutions/Python5/blob/master/Comparing%20JavaScript%20with%20Python.ipynb (that's direct to Github -- nbviewer is having problems right now, no wait it's working again) https://goo.gl/nj9RPO (using nbviewer) renders the JS output whereas Github does not. [3] a chess board generator, just uses string substitution ala str.format( ) method, helps beginners see how HTML + CSS might be string output from a Python script on the server: # -*- coding: utf-8 -*- """ Created on Thu Nov 17 09:02:27 2016 https://flic.kr/p/PjQ6Bg (screen shot). @author: Kirby Urner Run the script and open the output .html file in any browser. """ from collections import namedtuple Piece = namedtuple('Piece', 'type color position unicode') black = [ Piece("Rook" , "black", [7,0], "♜"), Piece("Knight" , "black", [7,1], "♞"), Piece("Bishop" , "black", [7,2], "♝"), Piece("Queen" , "black", [7,3], "♛"), Piece("King" , "black", [7,4], "♚"), Piece("Bishop" , "black", [7,5], "♝"), Piece("Knight" , "black", [7,6], "♞"), Piece("Rook" , "black", [7,7], "♜") ] for c in range(8): black.append(Piece("Pawn", "black", [6,c], "♟")) white = [ Piece("Rook" , "white", [0,0], "♖"), Piece("Knight" , "white", [0,1], "♘"), Piece("Bishop" , "white", [0,2], "♗"), Piece("Queen" , "white", [0,3], "♕"), Piece("King" , "white", [0,4], "♔"), Piece("Bishop" , "white", [0,5], "♗"), Piece("Knight" , "white", [0,6], "♘"), Piece("Rook" , "white", [0,7], "♖") ] for c in range(8): white.append(Piece("Pawn", "white", [1,c], "♙")) the_board = \ """ {white_royals} {white_pawns} {empty_cells} {black_pawns} {black_royals}
""" white_royals = "{}".format("".join( ["{}".format(piece.unicode) for piece in white[:8]])) white_pawns = "{}".format("".join( ["{}".format(piece.unicode) for piece in white[8:]])) black_royals = "{}".format("".join( ["{}".format(piece.unicode) for piece in black[:8]])) black_pawns = "{}".format("".join( ["{}".format(piece.unicode) for piece in black[8:]])) empty_cells = "" for row in range(4): empty_cells += "{}".format("".join( ["" for _ in range(8)])) chess_board = the_board.format(white_royals = white_royals, white_pawns = white_pawns, empty_cells = empty_cells, black_royals = black_royals, black_pawns = black_pawns) the_page = \ """ """ + \ chess_board \ + \ """ """ with open("chessboard02.html", "w") as f: f.write(the_page) print("Done!") -------------- next part -------------- An HTML attachment was scrubbed... URL: From kevin-lists at theolliviers.com Mon Nov 21 21:54:28 2016 From: kevin-lists at theolliviers.com (Kevin Ollivier) Date: Mon, 21 Nov 2016 18:54:28 -0800 Subject: [Edu-sig] Python + JS == more than their sum() In-Reply-To: References: Message-ID: On Mon, Nov 21, 2016 at 5:39 PM, kirby urner wrote: > > I'm continuing to advance the notion, in > Medium comments and elsewhere, that > learning one computer language at a > time may be less efficient than tackling > two or more, but with a "main one" front > burner. [1] > > I credit the LEX Institute for this idea.[2] > > The theory being: contrasts and comparisons > help concepts stick, whereas just one example > (of a language, human or computer) provides > less traction, a slipperier slope. > > Like learning the J language (jsoftware.com) > even a little helps one realize how different > languages can be, bringing Python into sharper > relief against a background. > > But J (of APL heritage) might be too exotic > as a #2, why not do JavaScript? Python + JS > could be as common as HTML + CSS. > I'm a lurker here, but I wanted to chime in and say that I'm using exactly this combo (HTML/JS frontend + Python backend) for pretty much every app I've written in the past few years. Needless to say, I've become a big proponent of the approach. In fact, I'm writing a little command line tool that helps create the scaffolding needed to make an app using this approach called PyEverywhere. ( http://pyeverywhere.org) It's still a work in progress, but I hope to have it supporting all major platforms by early-to-mid next year. >From a learning perspective, I think the JS + Python combo offers a lot of benefits. First, in this internet age it's hard to find developers who would have no use for some HTML + CSS + JS skills, so there's a huge benefit to teaching them early on as part of any programming curriculum. Second, I think the idea of separating front-end and back-end and using different tools really helps prepare them for the sort of technology stacks they will see in real-world apps. Finally, as you said yourself, different languages look at problems in different ways, and learning those different approaches helps build the flexibility to view a problem from different angles that any good programmer should have. Regards, Kevin > That's a little self serving as a common bootcamp > design if JS front end, Python back end. Our > PDX Code Guild in Portland takes that tack. > > The curriculum, then, would continually bring > them together to discuss their similarities and > differences. Either one could be foreground > first, with the other as background, but we'd > do a lot of jumping back and forth (and not > just with JSON :-D). > > A breakthrough realization I had earlier today > was that Jupyter Notebooks already gives me > a JavaScript interpreter, even when my main > kernel is Python 3. > > %%javascript at the top of any cell creates a > node-like experience, and I'm able to write > ES6 (JavaScript) with classes, arrow functions > and everything. It feels a lot like using > node --harmony testfile.js on cloud9 (another > learning platform I visit). > > Here's an example, of a Jupyter Notebook > running through nbviewer, with both Python > and JS code cells. The point is to show off > the similarities. > > https://goo.gl/nj9RPO > > Kirby > > Useful tools: > http://codepen.io/ > http://jsbin.com/ > > [1] https://goo.gl/U4Yx6l (comment on one > of Quincy Larson's, about which language > to learn first) > > [2] 'Who Is Fourier?' (one of its pubs) appears > way back in edu-sig. Jason Cunliff and I > met and talked about it in New York that > time. > > Here's one of Jason's from 2002: > > https://mail.python.org/pipermail/edu-sig/2002-September/002255.html > > > _______________________________________________ > Edu-sig mailing list > Edu-sig at python.org > https://mail.python.org/mailman/listinfo/edu-sig > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From wes.turner at gmail.com Tue Nov 22 10:15:04 2016 From: wes.turner at gmail.com (Wes Turner) Date: Tue, 22 Nov 2016 09:15:04 -0600 Subject: [Edu-sig] Python + JS == more than their sum() In-Reply-To: References: Message-ID: Some tips and resources for learning about Python and JS: mpld3 brings together Python and d3 Javascript data visualization library: Docs: http://mpld3.github.io Src: https://github.com/mpld3/mpld3 I haven't reviewed these sources for Code Injection bugs that do occur when e.g. generating JS with another language. ("XSS": "Cross-site scripting"). - http://cwe.mitre.org/top25/#CWE-79 *Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')* About JSON: - JSON should be parsed. - http://seriot.ch/parsing_json.php - JSON should not be eval()'d; because it could contain code. - While it's possible to template JSON into an HTML page, we usually like to retrieve the data separately from the code (because then we can cache the code and data separately); so REST or RPC API. - https://github.com/mgonto/restangular/blob/master/README.md#differences-with-resource - https://www.quora.com/Is-it-possible-to-consume-a-RESTful-API-with-React-js-alone-i-e-without-any-server-side-language-provided-the-API - JSONLD is a spec for Linked Data in JSON. There's a @context which defines URI namespaces for schema. JSON object {attributes:}, then, map to URIs. http://json-ld.org/playground/ - RDFJS apps can work with JSONLD. - There are other data interchange specs with JS support (Protocol Buffers, Thrift, Avro, Arrow, ). PyJS contains a Python to JS compiler Docs: http://pyjs.org Src: https://github.com/pyjs/pyjs Brython includes a Python interpreter written in JS; for use of Python as a HTML5 script language: Docs: https://brython.info Src: https://github.com/brython-dev/brython - Like Javascript, Brython has a DOM (Document Object Model) API: https://brython.info/static_doc/en/dom_api.html Folium integrates Python data and a JS data visualization library called leaflet.js: Src: https://github.com/python-visualization/folium Btw, (e.g. for a flipped classroom) these are great: - https://www.codecademy.com/courses/learn-git - https://www.codecademy.com/courses/learn-javascript (... jQuery, Angular, React) - https://www.codecademy.com/tracks/python (... - https://www.codecademy.com/apis (APIs! have request limits) On Monday, November 21, 2016, kirby urner wrote: > > I'm continuing to advance the notion, in > Medium comments and elsewhere, that > learning one computer language at a > time may be less efficient than tackling > two or more, but with a "main one" front > burner. [1] > > I credit the LEX Institute for this idea.[2] > > The theory being: contrasts and comparisons > help concepts stick, whereas just one example > (of a language, human or computer) provides > less traction, a slipperier slope. > > Like learning the J language (jsoftware.com) > even a little helps one realize how different > languages can be, bringing Python into sharper > relief against a background. > > But J (of APL heritage) might be too exotic > as a #2, why not do JavaScript? Python + JS > could be as common as HTML + CSS. > > That's a little self serving as a common bootcamp > design if JS front end, Python back end. Our > PDX Code Guild in Portland takes that tack. > > The curriculum, then, would continually bring > them together to discuss their similarities and > differences. Either one could be foreground > first, with the other as background, but we'd > do a lot of jumping back and forth (and not > just with JSON :-D). > > A breakthrough realization I had earlier today > was that Jupyter Notebooks already gives me > a JavaScript interpreter, even when my main > kernel is Python 3. > > %%javascript at the top of any cell creates a > node-like experience, and I'm able to write > ES6 (JavaScript) with classes, arrow functions > and everything. It feels a lot like using > node --harmony testfile.js on cloud9 (another > learning platform I visit). > > Here's an example, of a Jupyter Notebook > running through nbviewer, with both Python > and JS code cells. The point is to show off > the similarities. > > https://goo.gl/nj9RPO > > Kirby > > Useful tools: > http://codepen.io/ > http://jsbin.com/ > > [1] https://goo.gl/U4Yx6l (comment on one > of Quincy Larson's, about which language > to learn first) > > [2] 'Who Is Fourier?' (one of its pubs) appears > way back in edu-sig. Jason Cunliff and I > met and talked about it in New York that > time. > > Here's one of Jason's from 2002: > > https://mail.python.org/pipermail/edu-sig/2002-September/002255.html > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From kevin-lists at theolliviers.com Tue Nov 22 14:16:55 2016 From: kevin-lists at theolliviers.com (Kevin Ollivier) Date: Tue, 22 Nov 2016 11:16:55 -0800 Subject: [Edu-sig] Python + JS == more than their sum() In-Reply-To: References: Message-ID: On Tue, Nov 22, 2016 at 10:06 AM, kirby urner wrote: > > Wow, thank you Kevin and Wes for some > eye-opening contributions! > Same here, I am glad to see how much interest and activity there is in this area! :) Love the chessboard example, and I feel like I'll need to take a couple days out to investigate all the links Wes has posted! > I really welcome their mind-expanding > potential and have been diving into demos > and docs all morning. [1] > Sorry about the 404, it is really early days yet for the project, I had planned to get some docs up but as you can see I didn't quite manage it yet. :( I am using the toolkit for a couple apps right now, but I'm currently very busy finishing up an app for early childhood learning that has a hard deadline of Jan 10th, so I probably won't have time to give it some more love until after that. BTW, my own interest (and why I signed up for this list) is that I eventually want to have the app made such that children can contribute their own games. It would start with some very visual, Snap/Scratch-like tools aimed specifically at the game engine that would also serve as programming tutorials (with something like Kenney's Game Assets [1] for pre-made art), but eventually it would start showing them real code and allow them to have full control over the code, graphics and interface. Little Python+JS self-contained packages that can be plugged into the game engine. What I kind of hope will be the outcome of all this is for the older children to start building games that would be used to teach the younger children. Thanks, Kevin [1] http://www.kenney.nl/assets In my course last night we looked at that > Jupyter Notebook comparing ES6 and > Python scripts [2] and I also showed them > how Python may be used to write > HTML + CSS for browser rendering.[3] > > Output: https://flic.kr/p/PjQ6Bg (screen > shot). > > Some of my students are beginner programmers, > with little to no programming background > so we're really just going over the basics, but at > the same time we need to tune in the > ecosystem with is typically a combination of > > Python + HTML + CSS + JS + SQL + regex > > at least. > > I use sqlite3 module for the SQL part, re module > for regex. > > What we have in these resources though is > something even more ambitious, including > the ability to compile Python to JS! Wow. > > You know what they say: JS is the > assembly language of the web. > > Even developers using JS full stack use > transpilers to go from future JS -> past > JS (using Babel mostly). > > Future JS (from where we stand now) is > what looks more Python-like than ever. > > My current mode of teaching is to have > students install the Anaconda distro and > then to extend the library with the requests > and flask modules for exploring web stuff. > Anaconda includes command line conda > for using in place of pip, to get packages > from a large web of repositories. > > Now I see conda lets me install mpld3 to > my Mac with no issues. > > mackurner:~ kurner$ conda install mpld3 > > My teaching application is here: > thekirbster.pythonanywhere.com > > Kirby > > [1] Kevin, http://pyeverywhere.org/docs/ 404s > > [2] https://github.com/4dsolutions/Python5/blob/ > master/Comparing%20JavaScript%20with%20Python.ipynb > (that's direct to Github -- nbviewer is having problems > right now, no wait it's working again) > https://goo.gl/nj9RPO (using nbviewer) renders the > JS output whereas Github does not. > > [3] a chess board generator, just uses string > substitution ala str.format( ) method, helps > beginners see how HTML + CSS might be > string output from a Python script on the server: > > # -*- coding: utf-8 -*- > """ > Created on Thu Nov 17 09:02:27 2016 > https://flic.kr/p/PjQ6Bg (screen shot). > @author: Kirby Urner > > Run the script and open the output .html file > in any browser. > """ > from collections import namedtuple > > Piece = namedtuple('Piece', 'type color position unicode') > > black = [ > Piece("Rook" , "black", [7,0], "♜"), > Piece("Knight" , "black", [7,1], "♞"), > Piece("Bishop" , "black", [7,2], "♝"), > Piece("Queen" , "black", [7,3], "♛"), > Piece("King" , "black", [7,4], "♚"), > Piece("Bishop" , "black", [7,5], "♝"), > Piece("Knight" , "black", [7,6], "♞"), > Piece("Rook" , "black", [7,7], "♜") ] > > for c in range(8): > black.append(Piece("Pawn", "black", [6,c], "♟")) > > white = [ > Piece("Rook" , "white", [0,0], "♖"), > Piece("Knight" , "white", [0,1], "♘"), > Piece("Bishop" , "white", [0,2], "♗"), > Piece("Queen" , "white", [0,3], "♕"), > Piece("King" , "white", [0,4], "♔"), > Piece("Bishop" , "white", [0,5], "♗"), > Piece("Knight" , "white", [0,6], "♘"), > Piece("Rook" , "white", [0,7], "♖") ] > > for c in range(8): > white.append(Piece("Pawn", "white", [1,c], "♙")) > > the_board = \ > """ > > {white_royals} > {white_pawns} > {empty_cells} > {black_pawns} > {black_royals} >
""" > > white_royals = "{}".format("".join( > ["{}".format(piece.unicode) for piece in white[:8]])) > white_pawns = "{}".format("".join( > ["{}".format(piece.unicode) for piece in white[8:]])) > black_royals = "{}".format("".join( > ["{}".format(piece.unicode) for piece in black[:8]])) > black_pawns = "{}".format("".join( > ["{}".format(piece.unicode) for piece in black[8:]])) > > empty_cells = "" > for row in range(4): > empty_cells += "{}".format("".join( > ["" for _ in range(8)])) > > chess_board = the_board.format(white_royals = white_royals, > white_pawns = white_pawns, > empty_cells = empty_cells, > black_royals = black_royals, > black_pawns = black_pawns) > > the_page = \ > """ > > > > > > """ + \ > chess_board \ > + \ > """ > > > """ > > with open("chessboard02.html", "w") as f: > f.write(the_page) > > print("Done!") > > _______________________________________________ > Edu-sig mailing list > Edu-sig at python.org > https://mail.python.org/mailman/listinfo/edu-sig > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From wes.turner at gmail.com Tue Nov 22 20:02:47 2016 From: wes.turner at gmail.com (Wes Turner) Date: Tue, 22 Nov 2016 19:02:47 -0600 Subject: [Edu-sig] Python + JS == more than their sum() In-Reply-To: References: Message-ID: A couple of points: - strings are immutable - every str.__add__ creates copies of strings - str1 += str2 is equivalwnt to str3 = str1 + str2 So, if, for example, we have a 1KB string and we keep += adding 1KB strings, the allocated memory looks like: str1 # 1KB str2 # 1KB str_n # 1KB str1 += str2 # 1KB (str1), 1KB (str2), 2KB (str1` = str1 + str2) = 4 KB str1 += str_n # 1KB (str1), 1KB (str2), 2KB (str1` = str1 + str2), 3KB (str1`` = str1` + str_n) = 7 KB There's StringIO. StringIO supports .write() and doesn't require copying. AFAICT, there's not any user supplied input in the example you've shared here. If there was (e.g. "include the player name"), we would need to **escape** it in order to prevent XSS ("Cross-Site Scripting"); so that users couldn't add arbitrary HTML, JS, CSS to the page. Methods for escaping user-supplied input: HTML: - cgi.escape * (see: bleach) - https://pypi.python.org/pypi/bleach - Use a templating language and configure it to "autoescape" (e.g. Jinja2) - http://jinja.pocoo.org/docs/dev/api/#autoescaping is *off* by default. - https://pypi.python.org/pypi/MarkupSafe Markup(str) // __html__ - https://github.com/pallets/jinja/issues/528 - Django Templates have autoescaping on by default - (Jinja2 is very similar to Django Templates) - https://docs.djangoproject.com/en/1.10/ref/templates/language/#automatic-html-escaping JS: - json.dumps CSS: - ... "XSS" - https://cwe.mitre.org/top25/#CWE-79 - https://www.owasp.org/index.php/Cross-site_Scripting_(XSS) - https://en.wikipedia.org/wiki/Cross-site_scripting#Preventive_measures On Tuesday, November 22, 2016, kirby urner wrote: > > Wow, thank you Kevin and Wes for some > eye-opening contributions! > > I really welcome their mind-expanding > potential and have been diving into demos > and docs all morning. [1] > > In my course last night we looked at that > Jupyter Notebook comparing ES6 and > Python scripts [2] and I also showed them > how Python may be used to write > HTML + CSS for browser rendering.[3] > > Output: https://flic.kr/p/PjQ6Bg (screen > shot). > > Some of my students are beginner programmers, > with little to no programming background > so we're really just going over the basics, but at > the same time we need to tune in the > ecosystem with is typically a combination of > > Python + HTML + CSS + JS + SQL + regex > > at least. > > I use sqlite3 module for the SQL part, re module > for regex. > > What we have in these resources though is > something even more ambitious, including > the ability to compile Python to JS! Wow. > > You know what they say: JS is the > assembly language of the web. > > Even developers using JS full stack use > transpilers to go from future JS -> past > JS (using Babel mostly). > > Future JS (from where we stand now) is > what looks more Python-like than ever. > > My current mode of teaching is to have > students install the Anaconda distro and > then to extend the library with the requests > and flask modules for exploring web stuff. > Anaconda includes command line conda > for using in place of pip, to get packages > from a large web of repositories. > > Now I see conda lets me install mpld3 to > my Mac with no issues. > > mackurner:~ kurner$ conda install mpld3 > > My teaching application is here: > thekirbster.pythonanywhere.com > > Kirby > > [1] Kevin, http://pyeverywhere.org/docs/ 404s > > [2] https://github.com/4dsolutions/Python5/blob/master/ > Comparing%20JavaScript%20with%20Python.ipynb > (that's direct to Github -- nbviewer is having problems > right now, no wait it's working again) > https://goo.gl/nj9RPO (using nbviewer) renders the > JS output whereas Github does not. > > [3] a chess board generator, just uses string > substitution ala str.format( ) method, helps > beginners see how HTML + CSS might be > string output from a Python script on the server: > > # -*- coding: utf-8 -*- > """ > Created on Thu Nov 17 09:02:27 2016 > https://flic.kr/p/PjQ6Bg (screen shot). > @author: Kirby Urner > > Run the script and open the output .html file > in any browser. > """ > from collections import namedtuple > > Piece = namedtuple('Piece', 'type color position unicode') > > black = [ > Piece("Rook" , "black", [7,0], "♜"), > Piece("Knight" , "black", [7,1], "♞"), > Piece("Bishop" , "black", [7,2], "♝"), > Piece("Queen" , "black", [7,3], "♛"), > Piece("King" , "black", [7,4], "♚"), > Piece("Bishop" , "black", [7,5], "♝"), > Piece("Knight" , "black", [7,6], "♞"), > Piece("Rook" , "black", [7,7], "♜") ] > > for c in range(8): > black.append(Piece("Pawn", "black", [6,c], "♟")) > > white = [ > Piece("Rook" , "white", [0,0], "♖"), > Piece("Knight" , "white", [0,1], "♘"), > Piece("Bishop" , "white", [0,2], "♗"), > Piece("Queen" , "white", [0,3], "♕"), > Piece("King" , "white", [0,4], "♔"), > Piece("Bishop" , "white", [0,5], "♗"), > Piece("Knight" , "white", [0,6], "♘"), > Piece("Rook" , "white", [0,7], "♖") ] > > for c in range(8): > white.append(Piece("Pawn", "white", [1,c], "♙")) > > the_board = \ > """ > > {white_royals} > {white_pawns} > {empty_cells} > {black_pawns} > {black_royals} >
""" > > white_royals = "{}".format("".join( > ["{}".format(piece.unicode) for piece in white[:8]])) > white_pawns = "{}".format("".join( > ["{}".format(piece.unicode) for piece in white[8:]])) > black_royals = "{}".format("".join( > ["{}".format(piece.unicode) for piece in black[:8]])) > black_pawns = "{}".format("".join( > ["{}".format(piece.unicode) for piece in black[8:]])) > > empty_cells = "" > for row in range(4): > empty_cells += "{}".format("".join( > ["" for _ in range(8)])) > > chess_board = the_board.format(white_royals = white_royals, > white_pawns = white_pawns, > empty_cells = empty_cells, > black_royals = black_royals, > black_pawns = black_pawns) > > the_page = \ > """ > > > > > > """ + \ > chess_board \ > + \ > """ > > > """ > > with open("chessboard02.html", "w") as f: > f.write(the_page) > > print("Done!") > -------------- next part -------------- An HTML attachment was scrubbed... URL: From kirby.urner at gmail.com Tue Nov 22 22:49:03 2016 From: kirby.urner at gmail.com (kirby urner) Date: Tue, 22 Nov 2016 19:49:03 -0800 Subject: [Edu-sig] Python + JS == more than their sum() In-Reply-To: References: Message-ID: Wise counsel Wes, much to think about, in terms of risk mitigation (when that's the goal, which it often is). Thanks for the segue. Kirby -------------- next part -------------- An HTML attachment was scrubbed... URL: From wes.turner at gmail.com Tue Nov 22 22:55:08 2016 From: wes.turner at gmail.com (Wes Turner) Date: Tue, 22 Nov 2016 21:55:08 -0600 Subject: [Edu-sig] Python + JS == more than their sum() In-Reply-To: References: Message-ID: On Tuesday, November 22, 2016, kirby urner wrote: > > Wise counsel Wes, much to think about, in terms of risk mitigation (when > that's the goal, which it often is). > > Thanks for the segue. > YW! > > Kirby > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From wes.turner at gmail.com Fri Nov 25 12:57:56 2016 From: wes.turner at gmail.com (Wes Turner) Date: Fri, 25 Nov 2016 11:57:56 -0600 Subject: [Edu-sig] Python + JS == more than their sum() In-Reply-To: References: Message-ID: On Tuesday, November 22, 2016, Wes Turner > wrote: > > On Tuesday, November 22, 2016, kirby urner wrote: > >> >> Wise counsel Wes, much to think about, in terms of risk mitigation (when >> that's the goal, which it often is). >> >> Thanks for the segue. >> > - Khan Academy - Wikipedia: https://en.wikipedia.org/wiki/Khan_Academy - Homepage: - Src: https://github.com/Khan ?tab=repositories - Khan Academy Learning Dashboard - (optionally) links w/ teacher dashboard - Khan Academy Computer Programming (JS) lessons: https://www.khanacademy.org/computing/computer-programming/programming - ProcessingJS: - Wikipedia: https://en.m.wikipedia.org/wiki/Processing.js - Homepage: http://processingjs.org - Src: https://github.com/processing-js/processing-js - Khan Academy ProcessingJS lessons: https://www.khanacademy.org/computer-programming/new/pjs - Python Mode for Processing - Homepage: http://py.processing.org - Src: https://github.com/jdf/processing.py - Docs: https://github.com/kazimuth/processing-py-site - Jython (Java & Python) - Jython - Homepage: http://www.jython.org - Src: hg https://hg.python.org/jython - Src: https://github.com/jython/jython3 - Docs: http://www.jython.org/docs/ - Docs: http://www.jython.org/javadoc/ - Docs: http://www.jython.org/devguide/ - Docs: https://github.com/jython/book - Python2.7 (hg.python.org) - Python3.5 (github) - Three.js - Homepage: https://threejs.org - Src: https://github.com/mrdoob/three.js/ - Docs: https://threejs.org/docs/#Manual/Introduction/Creating_a_scene - 3D - Blender - Wrdrddocs: https://wrdrd.com/docs/consulting/art-design#blender - Has a Python API - Docs: https://www.blender.org/api/250PythonDoc/ - Unreal Engine - Wikipedia: https://en.wikipedia.org/wiki/Unreal_Engine - v4 supports C++ only - https://github.com/20tab/UnrealEnginePython - https://learnxinyminutes.com/docs/c++/ - Class Central - Homepage: https://www.class-central.com/ - Src: https://github.com/dhawalhshah/class-central - https://www.class-central.com/search?q=python+javascript+html5 > >> >> Kirby >> >> -------------- next part -------------- An HTML attachment was scrubbed... URL: From kirby.urner at gmail.com Sat Nov 26 20:32:46 2016 From: kirby.urner at gmail.com (kirby urner) Date: Sat, 26 Nov 2016 17:32:46 -0800 Subject: [Edu-sig] continuing with ES6 / Python comparison, other chatter Message-ID: I just had shared "sushi train" (conveyor belt actually) with a an IT chief with Everett School District, far north of here, during which we discussed whether or not listservs (such as edu-sig here) are on the decline across the board, having been replaced with other social media by next generations of Internet savvy. Do we know that for sure? For my part, I'm sure it depends on the subculture. I'm on a very active listserv around csound, the music synth language and engine, several posts a day. I'm sure sci.math is as frantic as ever. nbviewer seems to time out quite a bit and I don't think it's just me. Does the site get overloaded? I'm somewhat more likely than not to link directly to the Github version i.e. the raw source, as here: https://github.com/4dsolutions/Python5/blob/master/Comparing%20JavaScript%20with%20Python.ipynb Shortened: https://goo.gl/jUqIwA ...versus feeding the latter through nbviewer. However the latter does a more thorough job in many cases, so I find it's worth it when it works. The above Notebook was just now lengthened with a new comparison of ES6 and Python3 function calls. Question: will nbviewer accept a shortened URL as input? Answer: no, but you're free to shorten the "nbviewer + Github URL" combo naturally: https://goo.gl/HtM0NR Did you know ES6 is the first edition of JavaScript wherein what we Pythonistas call default named parameters and sequence parameters were first acquired? In the above Notebook I extend to another example showing these features in both, comparing two recipe() functions. One could say Python has two "rest parameters", one for "positionals," the others for "named". Perhaps in Python "keyword parameter" is a little more correct than "named parameter" as the latter implies use of = (naming) to give a default value, whereas as shown in the example, one may have unnamed parameters to the right of a sequence parameter, that as a consequence are only reachable with named arguments. Les (the above IT chief), is very familiar with the Chromebook scene around public schooling in the state just north of Oregon. I'm likely to venture into that space pretty soon, as a Portland-based trainer. This will be a day job so I'm hopeful I'll be continuing with the evening gig as "radio show" broadcaster (a zoom.us-based tele-class). Speaking of which, I've been dropping in on some of Trey Hunners chat sessions after the fact (I've yet to make it to a live showing). I learned quite a bit about duck typing in connection abc types such as Sequence, thanks to this video: https://www.crowdcast.io/e/duck-typing I'm guessing more people learn about such free resources from Twitterverse than from listservs these days, but I don't have hard data. I wonder if Python.org keeps any stats on gross subscriber numbers, posting rates etc. within its vast Mailman empire: https://mail.python.org/mailman/listinfo Kirby -------------- next part -------------- An HTML attachment was scrubbed... URL: From wes.turner at gmail.com Sat Nov 26 20:55:44 2016 From: wes.turner at gmail.com (Wes Turner) Date: Sat, 26 Nov 2016 19:55:44 -0600 Subject: [Edu-sig] continuing with ES6 / Python comparison, other chatter In-Reply-To: References: Message-ID: These are probably good for comparison: - https://learnxinyminutes.com/docs/javascript/ - https://learnxinyminutes.com/docs/python/ - https://learnxinyminutes.com/docs/python3/ ECMAScript / Javascript - https://en.wikipedia.org/wiki/ECMAScript - https://en.wikipedia.org/wiki/JavaScript - ES6 ES6 (ES2015 (ECMAScript 2015)) - Standard: http://www.ecma-international.org/ecma-262/6.0/ - http://www.ecma-international.org/ecma-262/6.0/#sec-additions-and-changes-that-introduce-incompatibilities-with-prior-editions - http://es6-features.org - https://github.com/lukehoban/es6features - https://kangax.github.io/compat-table/es6/ - http://caniuse.com/#feat=es6-class - https://github.com/babel/babel-standalone On Saturday, November 26, 2016, kirby urner wrote: > > I just had shared "sushi train" (conveyor belt actually) with > a an IT chief with Everett School District, far north of here, > during which we discussed whether or not listservs (such > as edu-sig here) are on the decline across the board, having > been replaced with other social media by next generations > of Internet savvy. Do we know that for sure? > > For my part, I'm sure it depends on the subculture. I'm on > a very active listserv around csound, the music synth > language and engine, several posts a day. I'm sure sci.math > is as frantic as ever. > > nbviewer seems to time out quite a bit and I don't think it's > just me. Does the site get overloaded? > > I'm somewhat more likely than not to link directly to the > Github version i.e. the raw source, as here: > > https://github.com/4dsolutions/Python5/blob/master/Comparing%20JavaScript% > 20with%20Python.ipynb > > Shortened: https://goo.gl/jUqIwA > > ...versus feeding the latter through nbviewer. However > the latter does a more thorough job in many cases, so > I find it's worth it when it works. > > The above Notebook was just now lengthened with a > new comparison of ES6 and Python3 function calls. > > Question: will nbviewer accept a shortened URL as > input? > > Answer: no, but you're free to shorten the "nbviewer > + Github URL" combo naturally: https://goo.gl/HtM0NR > > Did you know ES6 is the first edition of JavaScript > wherein what we Pythonistas call default named > parameters and sequence parameters were first > acquired? > > In the above Notebook I extend to another example > showing these features in both, comparing two recipe() > functions. > > One could say Python has two "rest parameters", one > for "positionals," the others for "named". > > Perhaps in Python "keyword parameter" is a little more > correct than "named parameter" as the latter implies > use of = (naming) to give a default value, whereas > as shown in the example, one may have unnamed > parameters to the right of a sequence parameter, > that as a consequence are only reachable with > named arguments. > > Les (the above IT chief), is very familiar with the > Chromebook scene around public schooling in the > state just north of Oregon. I'm likely to venture into > that space pretty soon, as a Portland-based trainer. > > This will be a day job so I'm hopeful I'll be continuing > with the evening gig as "radio show" broadcaster > (a zoom.us-based tele-class). > > Speaking of which, I've been dropping in on some > of Trey Hunners chat sessions after the fact (I've > yet to make it to a live showing). I learned quite > a bit about duck typing in connection abc types > such as Sequence, thanks to this video: > > https://www.crowdcast.io/e/duck-typing > > > I'm guessing more people learn about such free > resources from Twitterverse than from listservs these > days, but I don't have hard data. > > I wonder if Python.org keeps any stats on gross > subscriber numbers, posting rates etc. within its > vast Mailman empire: > > https://mail.python.org/mailman/listinfo > > Kirby > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From wes.turner at gmail.com Sat Nov 26 21:02:51 2016 From: wes.turner at gmail.com (Wes Turner) Date: Sat, 26 Nov 2016 20:02:51 -0600 Subject: [Edu-sig] continuing with ES6 / Python comparison, other chatter In-Reply-To: References: Message-ID: On Saturday, November 26, 2016, Wes Turner wrote: > These are probably good for comparison: > > - https://learnxinyminutes.com/docs/javascript/ > - https://learnxinyminutes.com/docs/python/ > - https://learnxinyminutes.com/docs/python3/ > - http://hg.toolness.com/python-for-js-programmers/raw-file/tip/PythonForJsProgrammers.html - http://jfine.bitbucket.org/docs/js4py/gotcha-quiz.html - https://reddit.com/r/Python/comments/401wtc/python_for_javascript_programmers/ > > > > ECMAScript / Javascript > > - https://en.wikipedia.org/wiki/ECMAScript > - https://en.wikipedia.org/wiki/JavaScript > - ES6 > > ES6 (ES2015 (ECMAScript 2015)) > > - Standard: http://www.ecma-international.org/ecma-262/6.0/ > - http://www.ecma-international.org/ecma-262/6. > 0/#sec-additions-and-changes-that-introduce-incompatibilities-with-prior- > editions > > - http://es6-features.org > - https://github.com/lukehoban/es6features > > - https://kangax.github.io/compat-table/es6/ > - http://caniuse.com/#feat=es6-class > > - https://github.com/babel/babel-standalone > > > On Saturday, November 26, 2016, kirby urner > wrote: > >> >> I just had shared "sushi train" (conveyor belt actually) with >> a an IT chief with Everett School District, far north of here, >> during which we discussed whether or not listservs (such >> as edu-sig here) are on the decline across the board, having >> been replaced with other social media by next generations >> of Internet savvy. Do we know that for sure? >> >> For my part, I'm sure it depends on the subculture. I'm on >> a very active listserv around csound, the music synth >> language and engine, several posts a day. I'm sure sci.math >> is as frantic as ever. >> >> nbviewer seems to time out quite a bit and I don't think it's >> just me. Does the site get overloaded? >> >> I'm somewhat more likely than not to link directly to the >> Github version i.e. the raw source, as here: >> >> https://github.com/4dsolutions/Python5/blob/master/ >> Comparing%20JavaScript%20with%20Python.ipynb >> >> Shortened: https://goo.gl/jUqIwA >> >> ...versus feeding the latter through nbviewer. However >> the latter does a more thorough job in many cases, so >> I find it's worth it when it works. >> >> The above Notebook was just now lengthened with a >> new comparison of ES6 and Python3 function calls. >> >> Question: will nbviewer accept a shortened URL as >> input? >> >> Answer: no, but you're free to shorten the "nbviewer >> + Github URL" combo naturally: https://goo.gl/HtM0NR >> >> Did you know ES6 is the first edition of JavaScript >> wherein what we Pythonistas call default named >> parameters and sequence parameters were first >> acquired? >> >> In the above Notebook I extend to another example >> showing these features in both, comparing two recipe() >> functions. >> >> One could say Python has two "rest parameters", one >> for "positionals," the others for "named". >> >> Perhaps in Python "keyword parameter" is a little more >> correct than "named parameter" as the latter implies >> use of = (naming) to give a default value, whereas >> as shown in the example, one may have unnamed >> parameters to the right of a sequence parameter, >> that as a consequence are only reachable with >> named arguments. >> >> Les (the above IT chief), is very familiar with the >> Chromebook scene around public schooling in the >> state just north of Oregon. I'm likely to venture into >> that space pretty soon, as a Portland-based trainer. >> >> This will be a day job so I'm hopeful I'll be continuing >> with the evening gig as "radio show" broadcaster >> (a zoom.us-based tele-class). >> >> Speaking of which, I've been dropping in on some >> of Trey Hunners chat sessions after the fact (I've >> yet to make it to a live showing). I learned quite >> a bit about duck typing in connection abc types >> such as Sequence, thanks to this video: >> >> https://www.crowdcast.io/e/duck-typing >> >> >> I'm guessing more people learn about such free >> resources from Twitterverse than from listservs these >> days, but I don't have hard data. >> >> I wonder if Python.org keeps any stats on gross >> subscriber numbers, posting rates etc. within its >> vast Mailman empire: >> >> https://mail.python.org/mailman/listinfo >> >> Kirby >> >> >> -------------- next part -------------- An HTML attachment was scrubbed... URL: From kirby.urner at gmail.com Sat Nov 26 21:21:55 2016 From: kirby.urner at gmail.com (kirby urner) Date: Sat, 26 Nov 2016 18:21:55 -0800 Subject: [Edu-sig] continuing with ES6 / Python comparison, other chatter In-Reply-To: References: Message-ID: Wes, your posts remind me of del.icio.us, the shared bookmark service. Is that still used? The Wikipedia page as of today seems uncertain. https://en.wikipedia.org/wiki/Delicious_(website) I see the website. Seems like we could mine it without signing in before? This page has no explanation. Why would anyone sign up for anything that opaque? I feel we do too little with bookmarks e.g. what web pages or services suck stuff from History and/or Bookmarks and bring it into the DOM itself, for whatever reason? Is there an API for that? Maybe bookmarks should be more like a queue, with smart algorithms suggesting we get back to them, helping us prioritize. Bookmarks aren't "aggressive" enough? Tagging and sharing. Graphing... More engines that run little "virtual networks" (network = polyhedron (considered in wireframe)), that we can pass around. Little "virtual webs" that frame existing web pages? You're free to jump into them, but just as free to use an alternative / framing link surface. Food for thought. Kirby -------------- next part -------------- An HTML attachment was scrubbed... URL: From wes.turner at gmail.com Sun Nov 27 03:26:39 2016 From: wes.turner at gmail.com (Wes Turner) Date: Sun, 27 Nov 2016 02:26:39 -0600 Subject: [Edu-sig] continuing with ES6 / Python comparison, other chatter In-Reply-To: References: Message-ID: On Saturday, November 26, 2016, kirby urner wrote: > > Wes, your posts remind me of del.icio.us, the > shared bookmark service. Is that still used? > The Wikipedia page as of today seems > uncertain. https://en.wikipedia.org/wiki/Delicious_(website) > I see the website. Seems like we could mine > it without signing in before? This page has > no explanation. Why would anyone sign up > for anything that opaque? > https://en.wikipedia.org/wiki/Scuttle_(software) https://github.com/bookieio/Bookie - AGPLv3 - Pyramid, SQLAlchemy, Celery - Full-Text Search ... ElasticSearch JSON API, Django Haystack > > I feel we do too little with bookmarks e.g. what > web pages or services suck stuff from History > and/or Bookmarks and bring it into the DOM > itself, for whatever reason? Is there an API > for that? > There are browser JS APIs for browser extensions (which generally run in a context above window.): - https://developer.chrome.com/extensions/bookmarks - https://developer.chrome.com/extensions/history - https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/bookmarks - https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/history - WebExtensions (chrome, firefox) - http://arewewebextensionsyet.com Yeoman : JS :: Cookiecutter : Python There are yeoman project scaffolds for browser extensions: - http://yeoman.io/generators/ - https://github.com/yeoman/generator-chrome-extension - https://github.com/dgil/generator-firefox-extension#readme Maybe bookmarks should be more like a queue, > with smart algorithms suggesting we get back > to them, helping us prioritize. Bookmarks aren't > "aggressive" enough? > A lesson plan is a (graph/tree) of Thing Sequences which is traversed (optimally?) - https://schema.org/Thing - https://schema.org/CreativeWork Node magnitudes come from expertly qualified content prioritizers. Bookmarks queue: - https://github.com/westurner/pbm/blob/master/pbm/plugins/queuefolder.py - https://bitbucket.org/westurner/workhours/src/tip/workhours/firefox/history.py - https://bitbucket.org/westurner/workhours/src/tip/workhours/webkit/ > Tagging and sharing. Graphing... > Labels and ACLs. Graphviz, NetworkX, D3JS, SigmaJS yEd WebGL, Canvas, WebRTC > > > More engines that run little "virtual networks" > (network = polyhedron (considered in wireframe)), > that we can pass around. Little "virtual webs" > that frame existing web pages? You're free > to jump into them, but just as free to use an > alternative / framing link surface. Food for > thought. > - Zotero collections are like labels - OpenLink Data Spaces (ODS) - What is the context / scope? ... TutorBot, TAbot - http://prefix.cc/skos:broader - http://prefix.cc/skos:narrower - "Curriculum Development Knowledge Annotation and Discovery Tool" - "OTOMH" - https://westurner.org/wiki/ideas#thingsequence-coursesequence-courseunit - ideally there'd be a tool to assist with preparing responses like these for various information APIs (mailing lists, markdown (github, gitlab, bitbucket, reddit), restructuredtext (sphinx docs)). > Kirby > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mark.engelberg at gmail.com Sun Nov 27 05:24:25 2016 From: mark.engelberg at gmail.com (Mark Engelberg) Date: Sun, 27 Nov 2016 02:24:25 -0800 Subject: [Edu-sig] Python + JS == more than their sum() In-Reply-To: References: Message-ID: I'm going to play devil's advocate and say that I don't think it is wise to introduce multiple programming languages until fairly late in a student's programming education. Let's imagine the following hypothetical conversation with an English teacher: Parent: Do you teach kids how to write high-quality essays? Teacher: Absolutely. There are a wide variety of tools used in the professional world, so we teach them all. After kids learn how to write a pargraph, first we show them how to type it up in Microsoft Word, and how to apply fonts and colors. Some may go on to become scientists and mathematicians, so we show them how to type the paragraph in LaTeX. Sometimes, they may want to share with classmates, so we show them all the features of Google Docs. And we also like to teach them how to type their paragraph in emacs in case they ever need to write essays on a unix terminal. In our advanced class, we show them how to layout the essay with Microsoft Publisher. We only use the latest... Publisher 2016, of course. Gotta get these kids ready for the real world. Parent: Um, you're kind of missing the point. When do you teach them how to construct a great essay? I think most of us can look at this conversation and see the absurdity, but this is exactly what many teachers tend to do with programming. Students do not need to learn multiple programming languages until they are quite advanced. Students need to learn how to think deeply about modeling problems with data and algorithms. As long as you pick a decent, multi-paradigm programming language as their first language, you won't run out of topics to teach within that language for many years. All the time you spend showing kids how to convert the same shallow programs between different syntaxes is wasted time -- time that could be spent teaching them how to solve harder problems. At some point, students who intend to program professionally do need to learn a variety of languages, but I think that point comes much later than a lot of teachers believe. -------------- next part -------------- An HTML attachment was scrubbed... URL: From wes.turner at gmail.com Sun Nov 27 10:46:45 2016 From: wes.turner at gmail.com (Wes Turner) Date: Sun, 27 Nov 2016 09:46:45 -0600 Subject: [Edu-sig] Python + JS == more than their sum() In-Reply-To: References: Message-ID: Some people say that Multi-lingual is easier to learn early on. - Pseudocode and ____, - Blockly (visual programming) and ____, - ____ and JS, - ____ and C, C++ - ____ and Java - ____ and OpenGL The "write head" metaphor and defragmentation may not be good ways to think about learning (particularly learning languages). i.e. striped may be advantageous for multi-linguality? - Language ____ and 3D GAMES (OpenGL, WebGL) - Event-based programming (on_event()) - Language ____ and Web (HTML, JS, CSS) - Data interchange - Patterns of reflection - API: RPC, REST - "Otherwise we'd need to write {data validators,} twice" - JSONschema Everyone learns JS eventually; it may be a good time to mention that == is not the same as === (and that writing one type of language syntax from another is often dangerous (XSS, SQLi) because then there's no longer a data/code (NX bit) separation of concerns). - dis.dis(str) shows the bytecode instructions On Sunday, November 27, 2016, Mark Engelberg wrote: > I'm going to play devil's advocate and say that I don't think it is wise > to introduce multiple programming languages until fairly late in a > student's programming education. > > Let's imagine the following hypothetical conversation with an English > teacher: > > Parent: Do you teach kids how to write high-quality essays? > Teacher: Absolutely. There are a wide variety of tools used in the > professional world, so we teach them all. After kids learn how to write a > pargraph, first we show them how to type it up in Microsoft Word, and how > to apply fonts and colors. Some may go on to become scientists and > mathematicians, so we show them how to type the paragraph in LaTeX. > ReStructuredText docstrings > Sometimes, they may want to share with classmates, so we show them all > the features of Google Docs. > - GitHub, GitLab - Card, Concersation, Confirmation - TDD, CI > > And we also like to teach them how to type their paragraph in emacs in > case they ever need to write essays on a unix terminal. In our advanced > class, we show them how to layout the essay with Microsoft Publisher. We > only use the latest... Publisher 2016, of course. Gotta get these kids > ready for the real world. > - Open source - Cross-platform (because, at home,) - Tool dependence - By hand, on paper > Parent: Um, you're kind of missing the point. When do you teach them how > to construct a great essay? > Prewriting, Structute - SDLC, TDD, Agile - https://en.wikipedia.org/wiki/Software_design_pattern - TDD > > I think most of us can look at this conversation and see the absurdity, > but this is exactly what many teachers tend to do with programming. > > Students do not need to learn multiple programming languages until they > are quite advanced. Students need to learn how to think deeply about > modeling problems with data and algorithms. As long as you pick a decent, > multi-paradigm programming language as their first language, you won't run > out of topics to teach within that language for many years. > True; but who needs to understand the CPython C API and CFFI? What is gc? > All the time you spend showing kids how to convert the same shallow > programs between different syntaxes is wasted time -- time that could be > spent teaching them how to solve harder problems. > Maybe a fair point; though hard problems often require e.g. CUDA for GPU parallelism. > At some point, students who intend to program professionally do need to > learn a variety of languages, but I think that point comes much later than > a lot of teachers believe. > > > - ____ and JS, -------------- next part -------------- An HTML attachment was scrubbed... URL: From kirby.urner at gmail.com Sun Nov 27 15:54:23 2016 From: kirby.urner at gmail.com (kirby urner) Date: Sun, 27 Nov 2016 12:54:23 -0800 Subject: [Edu-sig] Python + JS == more than their sum() In-Reply-To: References: Message-ID: On Sun, Nov 27, 2016 at 2:24 AM, Mark Engelberg wrote: > I'm going to play devil's advocate and say that I don't think it is wise > to introduce multiple programming languages until fairly late in a > student's programming education. > > Yeah, I agree you sketch a believable way in which a "many languages" approach could also be time-wasting. Good anthropology. One hopes for a world in which students cater to their own appetites, cafeteria style. I remember being glad for the survey overview course at Princeton, where engineering, computer science more specifically, were the constant siren call. This way I got hands on with APL, SNOBOL, some virtual assembler, FORTRAN, PL/1 and who knows what all else (a voluntarily took on whatever I could get my hands on). "This is so cool!" I was thinking, especially the APL (Iverson: A Programming Language -- I knew you'd know, so for other readers...). Thanks to early exposure to APL, I was very curious about J (jsoftware.com) later. I'm more working backwards from the bootcamp code school economy, where you either do full stack JavaScript, or some hybrid, with a server language like a P language, Ruby or a lower level system type-rigid language (C#, Java...). I'm somewhat locked into that matrix right now and need to make the best of it. PDX Code Guild is Python + JS + HTML + CSS and then of course there's persisting data with SQL / noSQL. That's a lot to cover in a few months. So why is (Python + JS) a viable combo again? You see where that takes me. I want to reassure people that (Python + JS) is more than the mere sum of the parts; new synergies will emerge. The thought process required to compare and contrast these two languages, appreciate their similarities, as well as their differences, is a kind of discrimination that also helps with learning either / both. You gain more traction with that minimum twoness of two general purpose programming languages (JS newly qualifies, since node at least -- let out of its browser cage). At the meta level, we could say, there's a generic problem of coupling chunks of software together by passing pointers or containers or objects or whatever metaphor. We call them subprocedures or as in Python, "callables" with functions and types both callable objects. Functions comprise their own type. When we do this, segue code, splice execution sequences, we typically think of "arguments" getting passed, with "parameters" on the other shoreline, all set to "match and catch" on the other side, in the territory of the callable, the other's scope. Then comes the problem of returning back, once work is done. JS has a generator function now too, same keyword yield. Each language solves this challenge its own way. Having at least a couple languages to showcase, examples of how it's done, clarifies what the generalization was in the first place, at the meta level, just as many examples of groups in a group theory book, brings forward what's in common across all these groups (closure etc.). Family resemblance and all that. JavaScript in the incarnation of ES6 is adding what we in Python World we call the sequence parameter (builds a tuple), and they call it their "rest" parameter, as in "absorbing or taking the rest". Their "object" (their thing with a Prototype) is like our dict with embedded lambda (function) values and intra-element shared bindings, but now they're getting a Map() more like our dict, in addition to a "class" keyword. In a presentation by a code school mentor, having these two languages on our plate provides an opportunity to draw attention to the generic problem being addressed, of argument-passing (with JS more of a moving target, adopting features of the more-slowly-changing Python). That's the other point I want to make in my courses: that with a language comes a story, of its inception and evolution, an unfolding scenario. Having at least two examples of such a narrative, even without diving in to the syntax too deeply, is another angle on "leaning to code" that makes sense to people, helps them retain what they've learned. "Oh, you mean like Python is an actor on some kind of world stage, with other languages also actors, and I'll be able to follow the action, like it's some kid of television". Yes, that's right. I need to devote more time tracking down Wes's links, a great resource of edu-sig readers. Another focus right now, in addition to the Python course I'm teaching, is this whole Polymer phenomenon and the web components chapter, ala Shadow-DOM and such as