From aivar.annamaa at ut.ee Sat Oct 1 01:09:00 2016 From: aivar.annamaa at ut.ee (Aivar Annamaa) Date: Sat, 01 Oct 2016 08:09:00 +0300 Subject: [Edu-sig] Thonny IDE 2.0 released Message-ID: <9d6376c10469e76eabac73bac659f0f2@pohl.ut.ee> Hi! Thonny is a Python IDE with great program animation capabilities. Version 2.0 is now available! Download and see what's new on http://thonny.cs.ut.ee/ Feedback and issues (https://bitbucket.org/plas/thonny/issues/new) are welcome! best regards, Aivar -------------- next part -------------- An HTML attachment was scrubbed... URL: From kirby.urner at gmail.com Sat Oct 8 23:53:51 2016 From: kirby.urner at gmail.com (kirby urner) Date: Sat, 8 Oct 2016 20:53:51 -0700 Subject: [Edu-sig] recommending David Beazley Message-ID: Like many of us, I recommend Beazley talks to newcomers to Python. http://worldgame.blogspot.com/2016/10/doing-homework.html I'll be getting to asyncio in this edition of my saisoft.net course, using IMDB.com through an open API I've been using already. We get JSON for a bunch of movies, kind of like Ramalho does with the nation flags (logos). [1] http://www.dabeaz.com/ http://shop.oreilly.com/product/0636920032519.do Looking forward to 3.6 / 3.7 Kirby [1] # -*- coding: utf-8 -*- """ Created on Mon Jul 14 2016 @author: Kirby Urner Uses API documented at http://www.omdbapi.com/ to query IMDB movie database. Uses pickle to store Movie instance https://docs.python.org/3.5/library/pickle.html LAB 3: __str__ has full access to self.content, a dict. Why not make it even cooler? If you don't have requests, there's a picked movie instance to play with. """ import requests # from collections import namedtuple import json import pickle # Movie = namedtuple("Movie", "status_code content") class Movie: def __init__(self, status_code, json_data): self.status = status_code self.content = json.loads(str(json_data, encoding="UTF-8")) def __str__(self): """ Good place to practice string formatting by adding more data to the output """ obj = self.content # decoded json, a dict the_title = "Title: {:^40}\n".format(obj["Title"]) the_actors = "Actors: \n" for actor in obj["Actors"].split(","): the_actors += ".....{:>30}\n".format(actor) the_story = ("Story: \n") the_story += obj["Plot"] return the_title + the_actors + the_story def __repr__(self): return "Movie(Title={}, Released={})".format(self.content["Title"], self.content["Released"]) def get_movie(url): r = requests.get(url) return Movie(r.status_code, r.content) def test_request_1(imdb_title): the_url = "http://www.omdbapi.com/?i={}&plot=full&r=json".format(imdb_title) # GET result = get_movie(the_url) # Movie object return result def test_request_2(name, year): print("-----------") the_url = "http://www.omdbapi.com/?t={}&y={}&plot=full&r=json".format(name, year) result = get_movie(the_url) # Movie object return result def pickle_it(the_movie): with open('movie.pickle', 'wb') as f: # context manager style # Pickle the 'data' dictionary using the highest protocol available. pickle.dump(the_movie, f, pickle.HIGHEST_PROTOCOL) def unpickle_it(): with open('movie.pickle', 'rb') as f: # The protocol version used is detected automatically, so we do not # have to specify it. the_movie = pickle.load(f) return the_movie if __name__ == "__main__": # means just importing will not trigger this block # movie = test_request_2("Titanic", "1997") movie = test_request_1("tt0317705") print(movie) -------------- next part -------------- An HTML attachment was scrubbed... URL: From kirby.urner at gmail.com Sun Oct 9 00:03:27 2016 From: kirby.urner at gmail.com (kirby urner) Date: Sat, 8 Oct 2016 21:03:27 -0700 Subject: [Edu-sig] Thonny IDE 2.0 released In-Reply-To: <9d6376c10469e76eabac73bac659f0f2@pohl.ut.ee> References: <9d6376c10469e76eabac73bac659f0f2@pohl.ut.ee> Message-ID: Thanks Alvar! Looks really cool. Looking forward to exploring it more. I have it installed and will be sharing it as an IDE to explore in my upcoming Python classes. https://flic.kr/p/M4pBaE Kirby On Fri, Sep 30, 2016 at 10:09 PM, Aivar Annamaa wrote: > Hi! > > Thonny is a Python IDE with great program animation capabilities. > > Version 2.0 is now available! Download and see what's new on > http://thonny.cs.ut.ee/ > > Feedback and issues (https://bitbucket.org/plas/thonny/issues/new) are > welcome! > > best regards, > Aivar > > > _______________________________________________ > 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 kirby.urner at gmail.com Tue Oct 11 18:41:37 2016 From: kirby.urner at gmail.com (kirby urner) Date: Tue, 11 Oct 2016 15:41:37 -0700 Subject: [Edu-sig] Jupyter Notebooks on Decorators & Context Managers Message-ID: Here are two Jupyter Notebooks the might be of interest to those of us teaching Python: Decorators: http://nbviewer.jupyter.org/github/4dsolutions/Python5/blob/master/Abducted%21.ipynb Context Managers: http://nbviewer.jupyter.org/github/4dsolutions/Python5/blob/master/SpookyCastle.ipynb I'll be using these in class tonight, with my students, a 7th of 10 sessions: 4 hrs each with 1 hr lab time, usually in three 20 min chunks. This is California PD w/ @saisoft.net My students are experienced IT workers e.g. one is a kernel developer for a database and has six patents in that area. She volunteered this. I'm not privy to their resumes otherwise. Also, I added a couple pictures to this one (CP4E type message), still tweeting it out quite a bit: https://medium.com/@kirbyurner/the-plight-of-high-school-math-teachers-c0faf0a6efe6#.d4hbhehrm Kirby @thekirbster @4DsolutionsPDX -------------- next part -------------- An HTML attachment was scrubbed... URL: From kirby.urner at gmail.com Sun Oct 16 20:37:29 2016 From: kirby.urner at gmail.com (kirby urner) Date: Sun, 16 Oct 2016 17:37:29 -0700 Subject: [Edu-sig] teaching module Message-ID: # -*- coding: utf-8 -*- """ Created on Fri Oct 14 17:45:13 2016 @author: Kirby Urner """ print("{:=^40}".format("< Exhibit 1: scoping controls >")) from random import choice def add_tricks(cls): """ choice(tricks) maintains access to add_tricks namespace, what's known as a "closure" (like a "bottled" space) cls.tricks = [...] would also work """ tricks = ["play dead", "roll over", "sit up"] def do_trick(self): return choice(tricks) cls.do_trick = do_trick return cls @add_tricks class Animal: """ Decorate a class with a function, end up with a new second inheritable method """ def __init__(self, nm): self.name = nm class Mammal(Animal): """Lets teach an old dog some new tricks... """ pass # Animal = add_tricks(Animal) <-- 'no decorator' alternative obj_1 = Animal("Rover") print(obj_1.name, "does this trick:", obj_1.do_trick()) obj_2 = Mammal("Trixy") print(obj_2.name, "does this trick:", obj_2.do_trick()) print("{:=^40}".format("< Exhibit 2: str() vs repr() >")) class Airport: """ Clarifying the relationship between str() & repr() """ def __init__(self, three_letter_code): # birth! self.code = three_letter_code def __str__(self): return "Airport w/ code: " + self.code def __repr__(self): return "Airport('{}')".format(self.code) portland_or = Airport("PDX") newark_nj = Airport("EWR") print(portland_or) # __str__ print(repr(portland_or)) # __repr__ print("{:=^40}".format("< Exhibit 3: scoping controls >")) brand = "Cheery Deary" # who can overwrite def outer(): brand = "Deco Echo" def inner(): # global brand nonlocal brand # reference enclosing scope brand = "Oompa Loompa" # could be local print("inner:",brand) inner() print("outer:",brand) outer() print("Global:", brand) -------------- next part -------------- An HTML attachment was scrubbed... URL: From wes.turner at gmail.com Mon Oct 17 20:37:37 2016 From: wes.turner at gmail.com (Wes Turner) Date: Mon, 17 Oct 2016 19:37:37 -0500 Subject: [Edu-sig] =?utf-8?q?K=E2=80=9312_Computer_Science_Framework_--_k1?= =?utf-8?q?2cs=2Eorg?= Message-ID: There is a new K?12 Computer Science Framework: - Homepage: https://k12cs.org - HTML: https://k12cs.org/navigating-the-practices/ - PDF: https://k12cs.org/wp-content/uploads/2016/09/K%E2%80%9312-Co mputer-Science-Framework.pdf - There are: Concepts and Practices - The site provides navigation by: Grade-Band, Concept, Progression - A number of CS organizations and companies have contributed Ideas / Feedback: - It may be helpful (and efficient) to coordinate [Python] CS educational resources with this new K-12 Computer Science Framework: - Additionally, I can't help but wonder whether it makes sense it start with TDD (Test-Driven Development) first when teaching Python (and STEM, and CS, in general). -------------- next part -------------- An HTML attachment was scrubbed... URL: From wes.turner at gmail.com Mon Oct 17 20:40:18 2016 From: wes.turner at gmail.com (Wes Turner) Date: Mon, 17 Oct 2016 19:40:18 -0500 Subject: [Edu-sig] =?utf-8?q?K=E2=80=9312_Computer_Science_Framework_--_k?= =?utf-8?q?12cs=2Eorg?= In-Reply-To: References: Message-ID: On Mon, Oct 17, 2016 at 7:37 PM, Wes Turner wrote: > There is a new K?12 Computer Science Framework: > [...] > > - Additionally, > I can't help but wonder whether it makes sense it start with TDD > (Test-Driven Development) first when teaching Python (and STEM, and CS, in > general). Hello World with TDD (and links to {Wikipedia, DBPedia} concept URIs): https://westurner.org/2016/10/17/teaching-test-driven-development-first.html import unittest class TestHelloWorld(unittest.Testcase): def setUp(self): # print("setUp") self.data = {'name': 'TestName'} def test_hello_world(self, data=None): if data is None: data = self.data name = data['name'] expected_output = "Hello, {}!".format(name) output = hello_world(name) assert expected_output == output self.assertEqual(ouput, expected_output) # def tearDown(self): # print("tearDown") # print(json.dumps(self.data, indent=2)) -------------- next part -------------- An HTML attachment was scrubbed... URL: From kirby.urner at gmail.com Tue Oct 18 12:33:09 2016 From: kirby.urner at gmail.com (kirby urner) Date: Tue, 18 Oct 2016 09:33:09 -0700 Subject: [Edu-sig] =?utf-8?q?K=E2=80=9312_Computer_Science_Framework_--_k?= =?utf-8?q?12cs=2Eorg?= In-Reply-To: References: Message-ID: Hi Wes -- I'm in agreement with points 7 & 8 in: https://code.org/files/Making_CS_Fundamental.pdf i.e. the policy of making compsci courses count towards math requirements. NCTM has endorsed this approach as well, though maybe only luke-warmly. The above paper, Making Computer Science Fundamental to K?12 Education: Eight Policy Ideas. is linked from: https://k12cs.org/implementation-curriculum-course-pathways-and-teacher-development/ wherein it's suggested high schools offer "specialized courses" in addition to AP CS. That leaves the door open for some much needed innovation and curriculum development (what role will the teachers themselves play in that?). Here's my main question: will already on-the-job math teachers get it together to offer these "specialized courses" that include significant amounts of programming? Example titles these high school math teachers might use: Hacking Math Class by Peter Farrell http://www.farrellpolymath.com/ (uses Raspberry-Pi) Mathematics for the Digital Age & Programming in Python by Litvin & Litvin http://www.skylit.com/mathandpython.html Doing Math with Python by Amit Saha https://www.nostarch.com/doingmathwithpython In other words, what public policies will enable / empower math teachers to shift gears and get certification to teach these specialized compsci-like courses? As a consultant to the Oregon legislature, and lobbyist, I'm keen to provide such opportunities to Oregon's math teachers, in part so we don't have to wait for an all new compsci faculty to boot itself up within every high school. That'll take longer than offering free professional devel- opment to the math teachers we've already got. It's not either / or. https://medium.com/@kirbyurner/the-plight-of-high-school-math-teachers-c0faf0a6efe6#.7wj2ik8o3 Thoughts? Kirby PS: also, yes to teaching unit testing, testing in general, early. That's part of the "check your work" ethic already prevalent in math teaching. I show that approach in action here, about composition of functions. https://github.com/4dsolutions/Python5/blob/master/Abducted!.ipynb (see code cell #5) -------------- next part -------------- An HTML attachment was scrubbed... URL: From kirby.urner at gmail.com Wed Oct 19 13:19:45 2016 From: kirby.urner at gmail.com (kirby urner) Date: Wed, 19 Oct 2016 10:19:45 -0700 Subject: [Edu-sig] a Circle type with radius, area both properties Message-ID: Speaking of sharing Python with math teachers, not just librarians (the bravest I sometimes thing), I included this Circle in the session last night (adults learning, andragogy at work): class Circle: """setting either the radius or area attribute sets the other as a dependent value. Initialized with radius only, unit circle by default. """ def __init__(self, radius = 1): self.radius = radius @property def area(self): return self._area @property def radius(self): return self._radius @area.setter def area(self, value): self._area = value self._radius = self.area / (2 * math.pi) @radius.setter def radius(self, value): self._radius = value self._area = math.pi * (self.radius ** 2) def __repr__(self): return "Circle(radius = {})".format(self.radius) the_circle = Circle(5)print("the_circle:", the_circle)print("Area: ", the_circle.area)the_circle.area = 50print("Radius when Area=50:", the_circle.radius) That's right, the area changes if you set the radius attribute and the other way around. I'm not claiming to be the first to think of doing this. We're free to program a lot of geometric types like that, that keep track of their own area and volume (a theme at thekirbster.pythonanywhere.com as well, the tiny Flask application I use as a classroom demo). Here's the Jupyter Notebook I put together before class, where the above Circle type appears: https://github.com/4dsolutions/Python5/blob/master/Descriptors%20and%20Properties.ipynb (also viewable in nbviewer.jupyter.org, just paste in the URL). Kirby -------------- next part -------------- An HTML attachment was scrubbed... URL: From kirby.urner at gmail.com Wed Oct 19 17:11:10 2016 From: kirby.urner at gmail.com (kirby urner) Date: Wed, 19 Oct 2016 14:11:10 -0700 Subject: [Edu-sig] a Circle type with radius, area both properties In-Reply-To: References: Message-ID: Excellent links, many thank yous. My query about the @property pattern was special to the Circle.radius / Circle.area co-variance, not like I imagined inventing the whole design pattern of co-variance. Who else does Circle in Python in 9th grade? Another one I'm close to having is where you have a Tetrahedron defined by its six edge lengths. You just get to change those, and it'll raise an exception if you try something impossible. Others vary in a specific way if they have to. What I've got on Github is the edges-to-volume algorithm already in Python. In adjusting each edge at a time, as to length, others accommodating, the computer can figure out all the coordinates (XYZ, IVM or whatever) and adjust the volume accordingly. One more object type among many. So do we let the math teachers teach this? I bet some will, whether or not we "let" them, right? Kirby On Wed, Oct 19, 2016 at 11:40 AM, Wes Turner wrote: > https://en.wikipedia.org/wiki/Observer_pattern > > - https://docs.python.org/2/reference/datamodel.html#object.__setattr__ > - https://github.com/ipython/traitlets/#callbacks-when-a- > trait-attribute-change > - https://traitlets.readthedocs.io/en/stable/ > using_traitlets.html#observe @observe decorator > > https://en.wikipedia.org/wiki/Reactive_programming > > >> -------------- next part -------------- An HTML attachment was scrubbed... URL: From wes.turner at gmail.com Wed Oct 19 14:40:17 2016 From: wes.turner at gmail.com (Wes Turner) Date: Wed, 19 Oct 2016 13:40:17 -0500 Subject: [Edu-sig] a Circle type with radius, area both properties In-Reply-To: References: Message-ID: https://en.wikipedia.org/wiki/Observer_pattern - https://docs.python.org/2/reference/datamodel.html#object.__setattr__ - https://github.com/ipython/traitlets/#callbacks-when-a-trait-attribute-change - https://traitlets.readthedocs.io/en/stable/using_traitlets.html#observe @observe decorator https://en.wikipedia.org/wiki/Reactive_programming On Wednesday, October 19, 2016, kirby urner wrote: > > Speaking of sharing Python with math teachers, not just > librarians (the bravest I sometimes thing), I included this > Circle in the session last night (adults learning, andragogy > at work): > > class Circle: > """setting either the radius or area attribute sets the other as a dependent value. Initialized with radius only, unit circle by default. """ > > def __init__(self, radius = 1): > self.radius = radius > > @property > def area(self): > return self._area > > @property > def radius(self): > return self._radius > > @area.setter > def area(self, value): > self._area = value > self._radius = self.area / (2 * math.pi) > > @radius.setter > def radius(self, value): > self._radius = value > self._area = math.pi * (self.radius ** 2) > > def __repr__(self): > return "Circle(radius = {})".format(self.radius) > the_circle = Circle(5)print("the_circle:", the_circle)print("Area: ", the_circle.area)the_circle.area = 50print("Radius when Area=50:", the_circle.radius) > > That's right, the area changes if you set the radius > attribute and the other way around. I'm not claiming > to be the first to think of doing this. > > We're free to program a lot of geometric types like > that, that keep track of their own area and volume (a > theme at thekirbster.pythonanywhere.com as well, > the tiny Flask application I use as a classroom demo). > > Here's the Jupyter Notebook I put together before > class, where the above Circle type appears: > > https://github.com/4dsolutions/Python5/blob/master/Descriptors%20and% > 20Properties.ipynb > > (also viewable in nbviewer.jupyter.org, just paste > in the URL). > > Kirby > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From wes.turner at gmail.com Wed Oct 19 14:52:57 2016 From: wes.turner at gmail.com (Wes Turner) Date: Wed, 19 Oct 2016 13:52:57 -0500 Subject: [Edu-sig] =?utf-8?q?K=E2=80=9312_Computer_Science_Framework_--_k1?= =?utf-8?q?2cs=2Eorg?= In-Reply-To: References: Message-ID: On Tuesday, October 18, 2016, kirby urner wrote: > > Hi Wes -- > > I'm in agreement with points 7 & 8 in: > > https://code.org/files/Making_CS_Fundamental.pdf > > i.e. the policy of making compsci courses count > towards math requirements. > > > NCTM has endorsed this approach as well, though > maybe only luke-warmly. > - [ ] K12 Graduation credits - [ ] Getting colleges to recognize said credits The code.org per-state factsheet PDFs list a number of objectives: https://code.org/promote > > The above paper, Making Computer Science > Fundamental to K?12 Education: Eight Policy Ideas. > is linked from: > > https://k12cs.org/implementation-curriculum-course-pathways- > and-teacher-development/ > > wherein it's suggested high schools offer "specialized courses" > in addition to AP CS. That leaves the door open for > some much needed innovation and curriculum development > (what role will the teachers themselves play in that?). > Incorporating this curriculum with existing STEM curriculum should be a priority for teachers with the flexibility to adapt their lesson plans. Curriculum development with OER resources can be as simple as nested
    s or as complex as {SCORM, TinCan, ...} > Here's my main question: will already on-the-job math > teachers get it together to offer these "specialized courses" > that include significant amounts of programming? > What incentives are there (beyond the obvious utility of CS skills in most career fields)? Is there #CSforAll grant money? - https://www.whitehouse.gov/blog/2016/01/30/computer-science-all - $4 billion, $100 million, $135 million - https://www.google.com/search?q=csforall+grant > Example titles these high school math teachers might use: > > Hacking Math Class by Peter Farrell > http://www.farrellpolymath.com/ (uses Raspberry-Pi) > > Mathematics for the Digital Age & Programming > in Python by Litvin & Litvin > http://www.skylit.com/mathandpython.html > > Doing Math with Python by Amit Saha > https://www.nostarch.com/doingmathwithpython > > In other words, what public policies will enable / empower > math teachers to shift gears and get certification to teach > these specialized compsci-like courses? > > As a consultant to the Oregon legislature, and lobbyist, > I'm keen to provide such opportunities to Oregon's math > teachers, in part so we don't have to wait for an all new > compsci faculty to boot itself up within every high school. > > That'll take longer than offering free professional devel- > opment to the math teachers we've already got. It's not > either / or. > Class-central lists a number of online courses both in CS and in general education. Is there yet a course for both which offers a certification / micro-credential? - https://www.class-central.com/subjects - "Computer Science" - "Education & Teaching" - [ ] A k12cs.org MOOC would be a good thing - Self-paced would be convenient - Regularly held http://schema.org/CourseInstances do offer more opportunities to collaborate with people working through the same material > https://medium.com/@kirbyurner/the-plight-of-high-school-mat > h-teachers-c0faf0a6efe6#.7wj2ik8o3 > > Thoughts? > > Kirby > > PS: also, yes to teaching unit testing, testing in general, early. > That's part of the "check your work" ethic already prevalent in > math teaching. I show that approach in action here, about > composition of functions. > > https://github.com/4dsolutions/Python5/blob/master/Abducted!.ipynb > (see code cell #5) > -------------- next part -------------- An HTML attachment was scrubbed... URL: From kirby.urner at gmail.com Thu Oct 20 14:24:09 2016 From: kirby.urner at gmail.com (kirby urner) Date: Thu, 20 Oct 2016 11:24:09 -0700 Subject: [Edu-sig] =?utf-8?q?K=E2=80=9312_Computer_Science_Framework_--_k?= =?utf-8?q?12cs=2Eorg?= In-Reply-To: References: Message-ID: On Wed, Oct 19, 2016 at 11:52 AM, Wes Turner wrote: > > >> Here's my main question: will already on-the-job math >> teachers get it together to offer these "specialized courses" >> that include significant amounts of programming? >> > > What incentives are there (beyond the obvious utility of CS skills in most > career fields)? > > Yeah, good question, what would incentivize a high school math teacher to want a new credential, if that's even what we're talking about. Why venture off the beaten path when our current curriculum seems so well-established and nailed down? The most obvious answer is job retention i.e. if students are free to vote with their feet and gravitate to those for-math- credit classes where coding features, those not prepared to including coding could lose traction? Won't Jack and/or Jill choose "computer math" once offered? That's an empirical question for which relevant #bigdata sets might be sought. Let the polling begin. Help students at least consider the possibilities. What I hear a lot is "if math teachers learn to program they'll re-enter the job market to grab a job with higher pay." That may be something of a myth though. Of course that happens, but many find teaching rewarding enough as a career, especially if it features professional development. In any case, the plan to attract computer science teachers in greater numbers would face exactly the same issue. What I expect will happen in Oregon is this new elite breed of computer math teachers will develop an esprit de corps that includes blessing its veterans wishing to turn five years of teaching and developing skills on the job, into some other careers, just as people in other careers might want to give teaching a try after acquiring experience in industry. I have no problem with such a revolving door in principle, also a feature in higher ed. Kirby -------------- next part -------------- An HTML attachment was scrubbed... URL: From kirby.urner at gmail.com Thu Oct 20 22:45:49 2016 From: kirby.urner at gmail.com (kirby urner) Date: Thu, 20 Oct 2016 19:45:49 -0700 Subject: [Edu-sig] a Circle type with radius, area both properties (fixed) Message-ID: > > @area.setter > def area(self, value): > self._area = value > self._radius = self.area / (2 * math.pi) > > Uh oh... I'm in the middle of teaching Session 10 and couldn't figure out why my radius for a smaller area was bigger. Couldn't be. I did my algebra wrong, duh. Here's the debugged version: # -*- coding: utf-8 -*- """ Created on Thu Oct 20 15:43:14 2016 @author: Kirby Urner toggle the import model_property on and off to see the example works the same either way. model_property contains a pure Python emulator of the built in property type. Related reading: https://mail.python.org/pipermail/edu-sig/2016-October/011548.html """ from model_property import Property as property import math class Circle: """setting either the radius or area attribute sets the other as a dependent value. Initialized with radius only, unit circle by default. """ def __init__(self, radius = 1): self.radius = radius @property def area(self): return self._area @property def radius(self): return self._radius @area.setter def area(self, value): self._area = value self._radius = math.sqrt(self._area / math.pi) #duh @radius.setter def radius(self, value): self._radius = value self._area = math.pi * (self._radius ** 2) def __repr__(self): return "Circle(radius = {})".format(self.radius) the_circle = Circle(5) print("the_circle:", the_circle) print("Area: ", the_circle.area) the_circle.area = 50 print("Radius when Area=50:", the_circle.radius) -------------- next part -------------- An HTML attachment was scrubbed... URL: From kirby.urner at gmail.com Thu Oct 20 22:49:09 2016 From: kirby.urner at gmail.com (kirby urner) Date: Thu, 20 Oct 2016 19:49:09 -0700 Subject: [Edu-sig] a Circle type with radius, area both properties (fixed) In-Reply-To: References: Message-ID: I swap in the pure Python emulator for the property type as a part of explaining how these decorators work: On Thu, Oct 20, 2016 at 7:45 PM, kirby urner wrote: > from model_property import Property as property >> >> # -*- coding: utf-8 -*- """ Created on Thu Oct 20 15:45:20 2016 @author: Python.org Emulates the built-in property type in pure Python """ class Property(object): "Emulate PyProperty_Type() in Objects/descrobject.c" def __init__(self, fget=None, fset=None, fdel=None, doc=None): self.fget = fget self.fset = fset self.fdel = fdel if doc is None and fget is not None: doc = fget.__doc__ self.__doc__ = doc def __get__(self, obj, objtype=None): if obj is None: return self if self.fget is None: raise AttributeError("unreadable attribute") return self.fget(obj) def __set__(self, obj, value): if self.fset is None: raise AttributeError("can't set attribute") self.fset(obj, value) def __delete__(self, obj): if self.fdel is None: raise AttributeError("can't delete attribute") self.fdel(obj) def getter(self, fget): return type(self)(fget, self.fset, self.fdel, self.__doc__) def setter(self, fset): return type(self)(self.fget, fset, self.fdel, self.__doc__) def deleter(self, fdel): return Property(self.fget, self.fset, fdel, self.__doc__) -------------- next part -------------- An HTML attachment was scrubbed... URL: From wes.turner at gmail.com Thu Oct 20 23:08:39 2016 From: wes.turner at gmail.com (Wes Turner) Date: Thu, 20 Oct 2016 22:08:39 -0500 Subject: [Edu-sig] a Circle type with radius, area both properties (fixed) In-Reply-To: References: Message-ID: On Thu, Oct 20, 2016 at 9:45 PM, kirby urner wrote: > @area.setter >> def area(self, value): >> self._area = value >> self._radius = self.area / (2 * math.pi) >> >> > Uh oh... I'm in the middle of teaching Session 10 > and couldn't figure out why my radius for a smaller > area was bigger. Couldn't be. I did my algebra > wrong, duh. > https://docs.python.org/2/library/unittest.html if __name__ == "__main__": # import unittest unittest.main() > Here's the debugged version: > > # -*- coding: utf-8 -*- > """ > Created on Thu Oct 20 15:43:14 2016 > > @author: Kirby Urner > > toggle the import model_property on and off to see > the example works the same either way. model_property > contains a pure Python emulator of the built in > property type. > > Related reading: > https://mail.python.org/pipermail/edu-sig/2016-October/011548.html > """ > > from model_property import Property as property > import math > > class Circle: > """setting either the radius or area attribute sets the other > as a dependent value. Initialized with radius only, unit > circle by default. > """ > > def __init__(self, radius = 1): > self.radius = radius > > @property > def area(self): > return self._area > > @property > def radius(self): > return self._radius > > @area.setter > def area(self, value): > self._area = value > self._radius = math.sqrt(self._area / math.pi) #duh > > @radius.setter > def radius(self, value): > self._radius = value > self._area = math.pi * (self._radius ** 2) > > def __repr__(self): > return "Circle(radius = {})".format(self.radius) > > the_circle = Circle(5) > print("the_circle:", the_circle) > print("Area: ", the_circle.area) > the_circle.area = 50 > print("Radius when Area=50:", the_circle.radius) > > _______________________________________________ > 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 kirby.urner at gmail.com Fri Oct 21 15:37:10 2016 From: kirby.urner at gmail.com (kirby urner) Date: Fri, 21 Oct 2016 12:37:10 -0700 Subject: [Edu-sig] a Circle type with radius, area both properties (fixed) In-Reply-To: References: Message-ID: > > >> Uh oh... I'm in the middle of teaching Session 10 >> and couldn't figure out why my radius for a smaller >> area was bigger. Couldn't be. I did my algebra >> wrong, duh. >> > > > https://docs.python.org/2/library/unittest.html > > if __name__ == "__main__": > # import unittest > unittest.main() > > > Yeah, seriously good advice. I've added unittests to the latest version, which I'll push to Github when the site once again becomes available. http://gizmodo.com/this-is-probably-why-half-the-internet-shut-down-today-1788062835 Kirby class TestCircle(unittest.TestCase): def testArea(self): the_circle = Circle(1) self.assertEqual(the_circle.area, math.pi, "Uh oh") def testRadius(self): the_circle = Circle(1) the_circle.area = math.pi * 4 # power rule self.assertEqual(the_circle.radius, 2, "Uh oh") a = TestCircle() # the test suite suite = unittest.TestLoader().loadTestsFromModule(a) unittest.TextTestRunner().run(suite) # run the test suite -------------- next part -------------- An HTML attachment was scrubbed... URL: From wes.turner at gmail.com Fri Oct 21 15:54:44 2016 From: wes.turner at gmail.com (Wes Turner) Date: Fri, 21 Oct 2016 14:54:44 -0500 Subject: [Edu-sig] a Circle type with radius, area both properties (fixed) In-Reply-To: References: Message-ID: IIRC, many computer labs have no internet access (as a closed loop learning environment). But if it's possible to host something like DevPi as a proxy cache in order to support pip for package installation, nose-progressive and pytest-sugar add a progressbar and other useful features to the nose and pytest test runners: - https://westurner.org/wiki/awesome-python-testing#nose - https://westurner.org/wiki/awesome-python-testing#py-test Fortunately, I have CloudFlare DNS/CDN in front of my GitHub Pages sites, so these should still be online today while DNS for a number of sites is down. ... jupyter/nbgrader has some cool CI-like features for teachers and students: - https://wrdrd.com/docs/consulting/education-technology#nbgrader - https://github.com/jupyter/nbgrader On Friday, October 21, 2016, kirby urner wrote: > >>> Uh oh... I'm in the middle of teaching Session 10 >>> and couldn't figure out why my radius for a smaller >>> area was bigger. Couldn't be. I did my algebra >>> wrong, duh. >>> >> >> >> https://docs.python.org/2/library/unittest.html >> >> if __name__ == "__main__": >> # import unittest >> unittest.main() >> >> >> > > > Yeah, seriously good advice. > > I've added unittests to the latest version, which I'll push to Github when > the site once again becomes available. > > http://gizmodo.com/this-is-probably-why-half-the-internet-shut-down-today- > 1788062835 > > Kirby > > > class TestCircle(unittest.TestCase): > > def testArea(self): > the_circle = Circle(1) > self.assertEqual(the_circle.area, math.pi, "Uh oh") > > def testRadius(self): > the_circle = Circle(1) > the_circle.area = math.pi * 4 # power rule > self.assertEqual(the_circle.radius, 2, "Uh oh") > > a = TestCircle() # the test suite > suite = unittest.TestLoader().loadTestsFromModule(a) > unittest.TextTestRunner().run(suite) # run the test suite > -------------- next part -------------- An HTML attachment was scrubbed... URL: From kirby.urner at gmail.com Sun Oct 23 12:13:43 2016 From: kirby.urner at gmail.com (kirby urner) Date: Sun, 23 Oct 2016 09:13:43 -0700 Subject: [Edu-sig] new JN on RSA etc. Message-ID: https://github.com/4dsolutions/Python5/blob/master/Silicon%20Forest%20Math%20Series%20%7C%20RSA.ipynb Per tweets (@4DsolutionsPDX) I'm advocating Oregon high school (Silicon Forest) computer math (the subject) include Vector, Polyhedron and Permutation types, as a starting place. Python is not assumed but is a reference language for some of us Silicon Foresters [0]. I've long had all the necessary demo software at cp4e.html and other places, but then the Vaults of Parnassus are vast (speaking figuratively, not about any specific cheese shop) so in terms of demos, we're not short on supplies. My suggestion is not that people use my Python code directly (though I make it available), but see these as the types of object anyone might build just to see how they tick. Then swap them around and use many versions, what open free software is all about. This Jupyter Notebook [1], hacked out yesterday, prototypes some of the lambda calc track I sketch out in my video [2] i.e. we'll be traversing a different patch than the calculus continuous math vista. This is a whole new way to earn math credit. Teachers will find it inspiring to be able to innovate in a space largely open for green field development, though we'll pull from the college-level literature. 'Mathematics for the Digital Age' traverses this new territory, as do the pages on crypto at my teaching website.[3] The Vector, Polyhedron and Permutation are each "hour of code" type types, meaning we get through the essentials in an hour or less and then turn to using them as instances in our applications. Kirby [0] https://medium.com/@kirbyurner/notes-from-a-silicon-forester-76d66d2f8742 (Notes from a Silicon Forester: more regional and autobiographical) [1] https://goo.gl/f6xFik (a shortened version of the above or role your own -- also consider using nbviewer option vs. direct to github, though for this particular notebook the differences currently won't matter. [2] https://youtu.be/eTDH7m4vEiM (118 views as of this morning, mostly aimed at high school math teachers in Oregon, whom I'm reaching in greater numbers thanks to Measure 97 (whether voted up or down, the organizing is re-making the state on many levels). [3] over 15 years old by now: http://www.4dsolutions.net/ocn/clubhouse.html -------------- next part -------------- An HTML attachment was scrubbed... URL: From kirby.urner at gmail.com Fri Oct 28 12:42:59 2016 From: kirby.urner at gmail.com (kirby urner) Date: Fri, 28 Oct 2016 09:42:59 -0700 Subject: [Edu-sig] Vpython inside Jupyter Notebooks In-Reply-To: References: Message-ID: Somehow I didn't expect using Python 3.5 with Vpython in Jupyter Notebooks would so easy. Bruce Sherwood has many examples at his Github account. I uploaded one yesterday to mine. https://github.com/4dsolutions/Python5/blob/master/Shapes%20with%20Vpython.ipynb Bruce has a viewing solution akin to nbviewer that actually renders the scene over the web somehow. I embed a JPEG where the rendering goes if running locally with Vpython installed. I wonder who else uses this edtech. I plan to demo it to teachers during an Hour of Code event come December. Kirby -------------- next part -------------- An HTML attachment was scrubbed... URL: From funcalculus at gmail.com Mon Oct 31 10:33:49 2016 From: funcalculus at gmail.com (Peter Farrell) Date: Mon, 31 Oct 2016 07:33:49 -0700 Subject: [Edu-sig] Edu-sig Digest, Vol 159, Issue 13 In-Reply-To: References: Message-ID: Kirby, That's great info. I love VPython! Glad teachers will be learning how to use it. Peter On Sat, Oct 29, 2016 at 9:00 AM, wrote: > Send Edu-sig mailing list submissions to > edu-sig at python.org > > To subscribe or unsubscribe via the World Wide Web, visit > https://mail.python.org/mailman/listinfo/edu-sig > or, via email, send a message with subject or body 'help' to > edu-sig-request at python.org > > You can reach the person managing the list at > edu-sig-owner at python.org > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of Edu-sig digest..." > > > Today's Topics: > > 1. Vpython inside Jupyter Notebooks (kirby urner) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Fri, 28 Oct 2016 09:42:59 -0700 > From: kirby urner > To: edu-sig at python.org > Subject: [Edu-sig] Vpython inside Jupyter Notebooks > Message-ID: > mail.gmail.com> > Content-Type: text/plain; charset="utf-8" > > Somehow I didn't expect using Python 3.5 with Vpython in Jupyter Notebooks > would so easy. > > Bruce Sherwood has many examples at his Github account. I uploaded one > yesterday to mine. > > https://github.com/4dsolutions/Python5/blob/master/Shapes%20with% > 20Vpython.ipynb > > Bruce has a viewing solution akin to nbviewer that actually renders the > scene over the web somehow. I embed a JPEG where the rendering goes if > running locally with Vpython installed. > > I wonder who else uses this edtech. I plan to demo it to teachers during an > Hour of Code event come December. > > Kirby > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: 20161028/bec34ae2/attachment-0001.html> > > ------------------------------ > > Subject: Digest Footer > > _______________________________________________ > Edu-sig mailing list > Edu-sig at python.org > https://mail.python.org/mailman/listinfo/edu-sig > > > ------------------------------ > > End of Edu-sig Digest, Vol 159, Issue 13 > **************************************** > -------------- next part -------------- An HTML attachment was scrubbed... URL: From kirby.urner at gmail.com Mon Oct 31 13:06:24 2016 From: kirby.urner at gmail.com (kirby urner) Date: Mon, 31 Oct 2016 10:06:24 -0700 Subject: [Edu-sig] teaching on a 3D canvas Message-ID: FYI, here's a posting to a closed archive physics list about using 3D vista generators in general. To teach physics or whatever. The Khan Academy genre is mostly flat chalkboard like surface for all teaching + voice. However as Youtube well demonstrates, there's a trend in the direction of using 3D animations in addition. ==== From: kirby urner Date: Sat, Oct 29, 2016 at 2:14 PM Subject: beyond the chalkboard: 3D game engines as a platform for physics teaching animations To: The Physics Learning Research List A segue off the Vpython thread... Studies in Human Motion included as a CDROM in the AAPT conferee packet one year a few back, had raw data for such Youtubes as these, developed using Python + POV-ray (not VPython): https://youtu.be/-j4ZealS1zI https://youtu.be/A0l3Q4Fu20E Body sensors knowing their own position in XYZ space fed time sliced data to spreadsheets, for conversion to still frames then animations. Lots of Youtubes summarize this process of motion capture. I like to think the "contrail" feature, added to Vpython, might have been somewhat inspired by such studies, though I have no evidence that that's true. However, regardless of tool chest, I see a cutting edge in Physics pedagogy is harnessing "game engines" or "virtual worlds" for didactic purposes. Here's a stash of such physics cartoons I stumbled across just this morning, perhaps old news to many subscribers here? https://www.youtube.com/watch?v=9Tm2c6NJH4Y (Physics videos by Eugene Khutoryansky) I don't actually know what this guy's workflow is, the details of his tool chest. I've been poking around on the web looking for more information and may contact him directly. He has collaborators, we know that much. We need to tease apart the adequacy of the physics and/or mathematical content, from the modality and/or aesthetic dimension in which Eugene operates. The output looks kind of computer game like, suggesting an engine (which one?), with a lot of attention to texturing and background. Compare Eugene's style with this other one: https://youtu.be/7u_UQG1La1o Is the surreality of Eugene's world extraneous? A cat watches the action in the Quantum Mechanics video, while the Maxwell's Equations one is inhabited by two angels in a somewhat Gothic setting. Given "Maxwell's Demon" is already in the literature, and that we've all heard of Schrodinger's Cat, I didn't see the imagery as entirely extraneous. He's alluding to known memes. In the mnemonic arts since Cicero and earlier, the idea of using exaggerated-because-more-memorable imagery has been encouraged. I wonder what research and academic papers have been published to draw attention to this emerging genre and to tackle such questions as (A) the efficacy of such animations and (B) given their potential efficacy for some learning styles (witness all the appreciative comments) how to best integrate them into existing curricula e.g. (i) should students just watch them or (ii) also make them? I'm seeing what we might call "Kahn Academy to the next level" i.e. we're moving to a more explicitly spatial / volumetric teaching environment whereas Khan's presentations specializes in 2D planar sketches, are much closer to a chalk board in that sense. I'm sure there's already considerable research on these topics, but as the technology is somewhat new, there's no doubt plenty of room for more. Kirby On Fri, Oct 28, 2016 at 7:11 PM, kirby urner wrote: > > Probably old news to many here, but I'm just discovering > I'm able to use Vpython aka "visual Python" inside > Jupyter Notebooks with not too much fuss. > On Mon, Oct 31, 2016 at 7:33 AM, Peter Farrell wrote: > Kirby, > > That's great info. I love VPython! Glad teachers will be learning how to > use it. > > Peter > > -------------- next part -------------- An HTML attachment was scrubbed... URL: