From kirby.urner at gmail.com Tue May 3 09:39:52 2011 From: kirby.urner at gmail.com (kirby urner) Date: Tue, 3 May 2011 00:39:52 -0700 Subject: [Edu-sig] What is a Python module? Message-ID: I posed this question before. The usual answer is: a file containing Python source code. But you can import .pyc files even after the .py files are been removed, likewise .pyd files. Is a Python module anything that's importable and runnable within Python, that responds to dir( ) etc.? True whether or not said module comes with readable source code. In fact, one could argue a Python module is precisely *not* the readable source code .py file, as that *must* be compiled to byte codes first, and saved in the .pyc. Kirby Ongoing curriculum writing (a window): http://mybizmo.blogspot.com/2011/05/lesson-planning.html From kb1pkl at aim.com Tue May 3 12:48:26 2011 From: kb1pkl at aim.com (Corey Richardson) Date: Tue, 03 May 2011 06:48:26 -0400 Subject: [Edu-sig] What is a Python module? In-Reply-To: References: Message-ID: <4DBFDD7A.4030506@aim.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 05/03/2011 03:39 AM, kirby urner wrote: > I posed this question before. The usual answer is: a file containing > Python source code. > > But you can import .pyc files even after the .py files are been > removed, likewise .pyd files. > > Is a Python module anything that's importable and runnable within > Python, that responds to dir( ) etc.? > > True whether or not said module comes with readable source code. > > In fact, one could argue a Python module is precisely *not* the > readable source code .py file, as that *must* be compiled to byte > codes first, and saved in the .pyc. A module is an object like any other: >>> import os >>> type(os) >>> a = os.__class__("hello!") >>> type(a) >>> dir(a) ['__doc__', '__name__'] You can even inherit from it! >>> import os >>> class MyModule(os.__class__): ... def __str__(self): ... return "hi!" ... >>> a = MyModule("name") >>> print a hi! Of course, if I ever see that in "real" code, I'd be worried. - -- Corey Richardson -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.17 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBAgAGBQJNv910AAoJEAFAbo/KNFvpohgH/jtY9D/uX+vLnwQHe3kz3fVf egJ3SG/H3SsC/y8iRXpRiG0JvW8EOQ4iL6FqxhMZ0vl9uEj4u7cd1Q7ocrw08Yua KVgjwfUJpFrLBKJzuDep6aThymmFmcpyYMdXC+sccHNklQQCi/kJa5KdK8+a7hvy ZGEa+jBqALzFEBj4DyU1lrCcxUqJ2vPKprP/d+DRv+kgLMd/dTfeolkkOjiM966X aexiV6Sj4MXg/51B9c2pJpZ1rngiRtJjXzagwRZFFpeDyThLCMkWgJcyIfFg4KgX vphjPrn+jRdZKBI1lVHG1dpgyaskvrfxnyRaRtQtpuxVr2K7pgVJmp1+GB2ZmM8= =3bbD -----END PGP SIGNATURE----- From kurner at oreillyschool.com Tue May 3 12:59:14 2011 From: kurner at oreillyschool.com (Kirby Urner) Date: Tue, 3 May 2011 03:59:14 -0700 Subject: [Edu-sig] What is a Python module? In-Reply-To: <4DBFDD7A.4030506@aim.com> References: <4DBFDD7A.4030506@aim.com> Message-ID: > > > A module is an object like any other: > > I agree with you Corey. So those saying a module consists of Python source code are being a bit loose with the term. It's sufficient that it behave in a Pythonic manner. We could have lots of Python modules without source in some collection. Kirby -------------- next part -------------- An HTML attachment was scrubbed... URL: From vernondcole at gmail.com Tue May 3 19:14:05 2011 From: vernondcole at gmail.com (Vernon Cole) Date: Tue, 3 May 2011 11:14:05 -0600 Subject: [Edu-sig] What is a Python module? Message-ID: On Tue, May 3, 2011 at 4:00 AM, wrote: > [Edu-sig] What is a Python module? I posed this question before. The usual answer is: a file containing > Python source code. > Kirby: The "usual" answer is almost the correct answer. I quote from http://docs.python.org/py3k/tutorial/modules.html which was written by GvR himself. A higher authority than BDFL cannot exist. "A module is a file containing Python definitions and statements. " I note that GvR does not mention that it must be in source form, only that it contain definitions and statements. The tutorial continues to give much more information about what modules are and how they work. In fact, one could argue a Python module is precisely *not* the > readable source code .py file, as that *must* be compiled to byte > codes first, and saved in the .pyc. One could make such an argument, but one would be incorrect. IronPython, for example, _never_ compiles to .pyc byte code, but the modules I write using it are still Python modules, and still do what modules are supposed to do. -- Vernon Cole -------------- next part -------------- An HTML attachment was scrubbed... URL: From kurner at oreillyschool.com Tue May 3 19:53:01 2011 From: kurner at oreillyschool.com (Kirby Urner) Date: Tue, 3 May 2011 10:53:01 -0700 Subject: [Edu-sig] What is a Python module? In-Reply-To: References: Message-ID: I appreciate your quoting GvR and continue to note that the source might already be yummy byte code in whatever target VM language, be that Java's or Mono's or some VM not yet written. "Source code is one step away from runtime digestible, in still needing to be parsed, and as such need not be distributed with compiled Python modules" would seem to be a true statement. One might imagine a "Python chat window" showing up as a chat service (shell) and behaving much as an ordinary Python interpreter in REPL mode (great for learning, we all agree). But behind the scenes, there's a lot of cloudy stuff, with some algorithms implemented in what looks to be LISP or Scheme. Obviously the CLR byte codes are runnable, but the source is mostly not even Python. So you go >>> import math but behind the scenes it's like J or something, with some bytecodes to a local engine via JSON perhaps, for AJAXy fun. Kirby On Tue, May 3, 2011 at 10:14 AM, Vernon Cole wrote: > On Tue, May 3, 2011 at 4:00 AM, wrote: > >> [Edu-sig] What is a Python module? > > I posed this question before. The usual answer is: a file containing >> Python source code. >> > > Kirby: > The "usual" answer is almost the correct answer. > I quote from http://docs.python.org/py3k/tutorial/modules.html which was > written by GvR himself. A higher authority than BDFL cannot exist. > "A module is a file containing Python definitions and statements. " > I note that GvR does not mention that it must be in source form, only that > it contain definitions and statements. The tutorial continues to give much > more information about what modules are and how they work. > > In fact, one could argue a Python module is precisely *not* the >> readable source code .py file, as that *must* be compiled to byte >> codes first, and saved in the .pyc. > > > One could make such an argument, but one would be incorrect. IronPython, > for example, _never_ compiles to .pyc byte code, but the modules I write > using it are still Python modules, and still do what modules are supposed to > do. > -- > Vernon Cole > > > _______________________________________________ > Edu-sig mailing list > Edu-sig at python.org > http://mail.python.org/mailman/listinfo/edu-sig > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From vernondcole at gmail.com Tue May 3 21:58:04 2011 From: vernondcole at gmail.com (Vernon Cole) Date: Tue, 3 May 2011 13:58:04 -0600 Subject: [Edu-sig] What is a Python module? In-Reply-To: References: Message-ID: Don't just imagine Python on a web site ... Try it. (load Silverlight first if you don't already have it. http://www.silverlight.net/ or for Linux http://www.mono-project.com/Moonlight ) http://www.trypython.org/ -- Vernon On Tue, May 3, 2011 at 11:53 AM, Kirby Urner wrote: > [...] > One might imagine a "Python chat window" showing up as a chat service > (shell) and behaving much as an ordinary Python interpreter in REPL mode > (great for learning, we all agree). > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From sigzero at gmail.com Tue May 3 23:03:26 2011 From: sigzero at gmail.com (Robert) Date: Tue, 3 May 2011 17:03:26 -0400 Subject: [Edu-sig] What is a Python module? References: Message-ID: On 2011-05-03 03:39:52 -0400, kirby urner said: > I posed this question before. The usual answer is: a file containing > Python source code. > If the answer isn't that I am send you an email teach! :) -- Robert -------------- next part -------------- An HTML attachment was scrubbed... URL: From kurner at oreillyschool.com Tue May 3 23:23:15 2011 From: kurner at oreillyschool.com (Kirby Urner) Date: Tue, 3 May 2011 14:23:15 -0700 Subject: [Edu-sig] What is a Python module? In-Reply-To: References: Message-ID: No good experience so far, using Chrome on XP. Anyway, sounds like we agree that Cloud Python might allow importing of modules the original source code language of which is indeterminant. A module is more a namespace, which students tend to say when still in beginner mind. Kirby On Tue, May 3, 2011 at 12:58 PM, Vernon Cole wrote: > Don't just imagine Python on a web site ... Try it. > (load Silverlight first if you don't already have it. > http://www.silverlight.net/ > or for Linux > http://www.mono-project.com/Moonlight ) > > http://www.trypython.org/ > -- > Vernon > > On Tue, May 3, 2011 at 11:53 AM, Kirby Urner wrote: > >> [...] >> One might imagine a "Python chat window" showing up as a chat service >> (shell) and behaving much as an ordinary Python interpreter in REPL mode >> (great for learning, we all agree). >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From kurner at oreillyschool.com Tue May 3 23:24:35 2011 From: kurner at oreillyschool.com (Kirby Urner) Date: Tue, 3 May 2011 14:24:35 -0700 Subject: [Edu-sig] What is a Python module? In-Reply-To: References: Message-ID: "Over 30% of the modules you will be importing today were written in either Erlang or Haskell..." That's going to make sense, right? Kirby On Tue, May 3, 2011 at 2:03 PM, Robert wrote: > On 2011-05-03 03:39:52 -0400, kirby urner said: > > > I posed this question before. The usual answer is: a file containing > > Python source code. > > > > If the answer isn't that I am send you an email teach! :) > > > -- > > Robert > > _______________________________________________ > Edu-sig mailing list > Edu-sig at python.org > http://mail.python.org/mailman/listinfo/edu-sig > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From kirby.urner at gmail.com Tue May 3 23:36:07 2011 From: kirby.urner at gmail.com (kirby urner) Date: Tue, 3 May 2011 14:36:07 -0700 Subject: [Edu-sig] What is a Python module? In-Reply-To: References: Message-ID: Wait, OK, there we go, Silverlight installed. OK, cool, a handsome Python REPL. At OST we use server hosted Eclipse with remote desktop, pretty off the shelf but with some custom guts. Kirby On Tue, May 3, 2011 at 2:23 PM, Kirby Urner wrote: > No good experience so far, using Chrome on XP. > Anyway, sounds like we agree that Cloud Python might allow importing of > modules the original source code language of which is indeterminant. > A module is more a namespace, which students tend to say when still in > beginner mind. > Kirby > > On Tue, May 3, 2011 at 12:58 PM, Vernon Cole wrote: >> >> Don't just imagine Python on a web site ... Try it. >> (load Silverlight first if you don't already have >> it.?http://www.silverlight.net/ >> or for Linux?http://www.mono-project.com/Moonlight?) >> http://www.trypython.org/ >> -- >> Vernon >> >> On Tue, May 3, 2011 at 11:53 AM, Kirby Urner >> wrote: >>> >>> [...] >>> One might imagine a "Python chat window" showing up as a chat service >>> (shell) and behaving much as an ordinary Python interpreter in REPL mode >>> (great for learning, we all agree). >> > > > _______________________________________________ > Edu-sig mailing list > Edu-sig at python.org > http://mail.python.org/mailman/listinfo/edu-sig > > From kurner at oreillyschool.com Wed May 4 06:07:46 2011 From: kurner at oreillyschool.com (Kirby Urner) Date: Tue, 3 May 2011 21:07:46 -0700 Subject: [Edu-sig] snapshotting some instructional scaffolding... Message-ID: """ OST Skunkworks: Freakish Tractor generator that moves forward to a boundary reading current character, writing current marker. Fuel might run out. send protocol may be employed to tank up, redirect, change the marker. Farm is an n x m array, presumably smallish, for interactive console experiments. -- Python track, O'Reilly School of Technology http://www.facebook.com/oreillyschool Also: http://mybizmo.blogspot.com/2011/05/lesson-planning.html """ class Farm: def __init__(self, rows=8, columns=8, facing="N", bg="*"): self.h = rows self.w = columns self.facing = facing self.bg = bg # background character self.tractors = [] # like Snake or Dog stomach self.field = [list(bg*self.w) for x in range(self.h)] # model self.framenumber = 0 self.trace = [] def add(self, tractor): self.tractors.append(tractor) def ticktock(self): # controller """tick tock o' the clock time marches on! Advance each tractor in the direction it's facing, ignoring stuck tractors already at a fence (some types of Tractor are smarter than others about fences). """ for tractor in self.tractors: try: next(tractor) # state changer except StopIteration: pass # harmless stuck tractor signal self.framenumber += 1 return self.framenumber def render(self): display="" for line in self.field: display += "".join(line)+"\n" return display # view __str__ = render def __repr__(self): return "Farm({},{}) @ {}".format(self.w, self.h, id(self)) def tractor(thefarm , pos = [0,0], facing="N", marker="O", fuel=10): "pos is mutable = current position" while True: y,x = pos if fuel > 0: if facing == "N": if y > 0: y -= 1 else: raise StopIteration elif facing == "S": if y < thefarm.h - 1: y += 1 else: raise StopIteration elif facing == "W": if x > 0: x -= 1 else: raise StopIteration elif facing == "E": if x < thefarm.w - 1: x += 1 else: raise StopIteration fuel -= 1 pos = (y,x) else: raise StopIteration changes = yield (thefarm.field[y][x], pos, fuel) thefarm.field[y][x] = marker if changes: facing = changes.get('facing',facing) marker = changes.get('marker',marker) fuel = changes.get('fuel',fuel) pos = changes.get('pos',pos) def _test(n): # Agile Programming: TDD is your friend thefarm = Farm(20,20, bg = ".") print("Empty field, all is peaceful", thefarm, sep="\n\n") # frame of film t1 = tractor(thefarm, pos=[10,10], marker="O", facing="N") t2 = tractor(thefarm, pos=[10,11], marker="X", facing="S") thefarm.add(t1) thefarm.add(t2) print("Showing the tractors in a list: ", thefarm.tractors, "===", sep="\n") print("A busy day begins...", thefarm, sep="\n\n") # frame of film for arrow_of_time in range(n): thefarm.ticktock() # much physics involved in terms of what's a realistic throughput print("After {} ticks of the clock, the tractors have moved...".format(n), thefarm, sep="\n\n") # frame of film if __name__ == "__main__": _test(10) -------------- next part -------------- An HTML attachment was scrubbed... URL: From kurner at oreillyschool.com Wed May 4 20:10:57 2011 From: kurner at oreillyschool.com (Kirby Urner) Date: Wed, 4 May 2011 12:10:57 -0600 Subject: [Edu-sig] snapshotting some instructional scaffolding... In-Reply-To: References: Message-ID: On Tue, May 3, 2011 at 10:07 PM, Kirby Urner wrote: > """ > OST Skunkworks: Freakish Tractor > generator that moves forward to a boundary reading > current character, writing current marker. Fuel > might run out. send protocol may be employed to > tank up, redirect, change the marker. Farm is an > n x m array, presumably smallish, for interactive > console experiments. > -- Python track, O'Reilly School of Technology > http://www.facebook.com/oreillyschool > Also: > http://mybizmo.blogspot.com/2011/05/lesson-planning.html > """ As CS teachers know, it's often instructive to start not with a blank canvas but some discrete unit of working code that may be set back to zero (back to factory) at any point. One then develops forward by adding features, by various deltas, these being the student projects. Many curricula focus on game frameworks and branching along those. Laura and I have done stuff with playing cards in this archive, and that remains a focus in many a Combinatorics course. In the case of the above, we're pushing the boundaries of what generators are good for. Adding a "run out of fuel" feature has potential is many times we'd like to iterate over a generator up to a certain point. itertools has islice for that. Here we inject a finite energy budget into the generator upon initialization. It could terminate for no other reason that "running out of gas". In a next iteration, the Tractor becomes a class with a __next__ and an __iter__ method. Student projects begin from there, again adding features, or simply making use of as is, as means to other ends. A subclass of Tractor called a CropCircle participates in mowing the Mandelbrot Set (or 48 of them do -- I shared a demo in the faculty lounge). http://www.flickr.com/photos/17157315 at N00/5646223789/sizes/l/in/set-72157625646071793/ http://www.brainsturbator.com/articles/crash_course_on_crop_circles_the_sequel/ Kirby -------------- next part -------------- An HTML attachment was scrubbed... URL: From calcpage at aol.com Sat May 7 23:08:37 2011 From: calcpage at aol.com (A. Jorge Garcia) Date: Sat, 07 May 2011 17:08:37 -0400 Subject: [Edu-sig] NEW: Blogs, Videos and Donorschoose! In-Reply-To: <8CDC5FC8252106C-FFC-24415@webmail-d026.sysops.aol.com> References: <8CDC5FC8252106C-FFC-24415@webmail-d026.sysops.aol.com> Message-ID: <8CDDB121124D4EB-1B44-1F7D8@TSTMAIL-D02.sysops.aol.com> Please enjoy my latest blogs about Learning and Teaching Math and Computing with technology! http://shadowfaxrant.blogspot.com/2011/05/2-so-many-hard-drives-so-little-time.html http://shadowfaxrant.blogspot.com/2011/05/smartboard-on-linux-they-said-it-could.html http://shadowfaxrant.blogspot.com/2011/04/science-fact-fiction-conventions-2010.html http://shadowfaxrant.blogspot.com/2011/04/conventions-conferences-art-shows-oh-my.html Please enjoy my latest blogs about Computing Independent Study class building a Linux Cluster! http://cistheta.blogspot.com/2011/02/cistheta-meeting-x-2010-2011_309.html http://cistheta.blogspot.com/2011/03/cistheta-meeting-xi-2010-2011_11.html http://cistheta.blogspot.com/2011/03/cistheta-meeting-xii-2010-2011_26.html http://cistheta.blogspot.com/2011/04/cistheta-meeting-xiii-2010-2011-instant.html Here's my new preCalculus screen-casts (starting Calculus)! http://www.youtube.com/calcpage2009 Here's some math and computer songs my studemts made for YouTube! http://www.youtube.com/cistheta2007 Here's my current DonorsChoose project! http://www.donorschoose.org/donors/proposal.html?id=520470&challengeid=32688#materials Thanx, A. Jorge Garcia Applied Math and CompSci http://shadowfaxrant.blogspot.com http://www.youtube.com/calcpage2009 From kurner at oreillyschool.com Tue May 10 01:11:13 2011 From: kurner at oreillyschool.com (Kirby Urner) Date: Mon, 9 May 2011 16:11:13 -0700 Subject: [Edu-sig] Game of Life in Sketchup; unittesting and TDD (pedagogy) Message-ID: Hey Gregor, I'm being somewhat hopelessly abstruse (obtuse?) in this philosophy list. You'll see your name going by, in connection with that Wittgenstein sister's house in Vienna: http://groups.yahoo.com/group/WittrsAMR/message/4360?var=0&l=1 BBC spent some time on it (her house) in some erudite TV such as USAers tend to not make, only import. Fie on those dumbed down university Youtube stations, or maybe I'm missing the best links? In other news, we've got Conway's Game of Life stacking up in Google SketchUp, per this earlier thread. http://mail.python.org/pipermail/edu-sig/2011-April/010280.html http://www.flickr.com/photos/17157315 at N00/5704569299/sizes/l/in/set-72157625646071793/ (feel free to join us on Facebook, note my invite to point to a favorite Game of Life implementation, using Python one would expect, if you're coming from edu-sig). Nathan's was likely done in Ruby though, though he uses Python quite a lot. I'll check with him and report back. Wait... this just in: """ Well that was quick! I considered using Python, but the API didn't look mature enough, and It turned out Ruby and Python have a lot in common. -- Nathan H. Nifong http://nathannifong.com """ I'm finding unittest as a centerpiece of a Python curriculum is quite an albatross in some respects, simply because the coding assignments are still small so the ratio of testing code to code being tested is rather too high. That's neither an argument against test driven development (TDD), nor against unittest in a company context, where back office workbenches enforce company standards. But when you're first donning the hat of "developer", you want that quick turnaround associated with running your module top level. A little demo at the bottom gets the focus: def _test( ): """ << demo of what this module might do for you >> """ if __name__ == "__main__": _test( ) is what we want to see in student projects, meaning what they release to the world comes with a kind of built in testing that shows off native functionality. It's like doctest but different in that we're not showing interactions, though we could be. We're just giving the module a workout, making it do stupid pet tricks. _test contains tests like the developer used to make the code pass, keeping some proof in the pudding. _test( ) is what's portable, comes with the module as "batteries included". Behind the scenes, back at Mother Ship, you have your more ambitious testing framework. So it's not either/or. Kirby -------------- next part -------------- An HTML attachment was scrubbed... URL: From kb1pkl at aim.com Tue May 10 03:06:56 2011 From: kb1pkl at aim.com (Corey Richardson) Date: Mon, 09 May 2011 21:06:56 -0400 Subject: [Edu-sig] Game of Life in Sketchup; unittesting and TDD (pedagogy) In-Reply-To: References: Message-ID: <4DC88FB0.300@aim.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 05/09/2011 07:11 PM, Kirby Urner wrote: > It's like doctest but different in that we're not showing interactions, > though we could be. I saw in #python that someone was working on making doctest even more useful, and having some of the features of unittest (and I believe he was working on running doctests from unittests). I don't mind doctest in smaller quantities, and sphinx makes it look good on the user-facing side. When I'm teaching newcommers I used to avoid testing until the last possible moment (even in my AP CS class we never once had to have formal tests for our code...) to cover it, and it was scanty. Now I usually teach mostly full TDD with the doctest module, and then show them unittest later on. I think it makes the docstrings look ugly, but testing is more important than aesthetics. my 2c, - -- Corey Richardson -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.17 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBAgAGBQJNyI+wAAoJEAFAbo/KNFvpyXoIAIjwW0cJh9/llWj4ZsLmL9YE IbnK9wHTurJFdMRt2l4FH1IlMRSBRzH+m5FBSVT/dfhgu4BA+BWDBx4Tif8ywt45 EIj1ratgD3qb7BPnBMA5f47ZAUlFMOKnFD8pUJibTYUM8uU5k7/7j9KSijj2Gwx4 LAjr9ESZV8cDrFh/wMZxWE5SuMqoKmQPBz7JLh+x54MJ2hdhwApcPOIgWSfMNxhX /8yMmUcOUcgnFJh85dMGhJ3fZA1xtgHmy1N9hNF/f0lP3FIY+hcLyrP7WKwLOzw+ wI5HF8hK663Fk9M7SZQe4Wu4jZKvvGIYJt1ag4tuFDpfW2jcaYzOWYUALhriZQ0= =4VOF -----END PGP SIGNATURE----- From kurner at oreillyschool.com Tue May 10 03:46:24 2011 From: kurner at oreillyschool.com (Kirby Urner) Date: Mon, 9 May 2011 18:46:24 -0700 Subject: [Edu-sig] Game of Life in Sketchup; unittesting and TDD (pedagogy) In-Reply-To: <4DC88FB0.300@aim.com> References: <4DC88FB0.300@aim.com> Message-ID: On Mon, May 9, 2011 at 6:06 PM, Corey Richardson wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > On 05/09/2011 07:11 PM, Kirby Urner wrote: > > It's like doctest but different in that we're not showing interactions, > > though we could be. > > I saw in #python that someone was working on making doctest even more > useful, and having some of the features of unittest (and I believe he > was working on running doctests from unittests). I don't mind doctest in > smaller quantities, and sphinx makes it look good on the user-facing side. > > When I'm teaching newcommers I used to avoid testing until the last > possible moment (even in my AP CS class we never once had to have formal > tests for our code...) to cover it, and it was scanty. Now I usually > teach mostly full TDD with the doctest module, and then show them > unittest later on. I think it makes the docstrings look ugly, but > testing is more important than aesthetics. > > my 2c, > - -- > Corey Richardson > Seems a reasonable approach. Likewise this OST curriculum sanely begins with core basics, phases in doctest, then unittest. The TDD philosophy is well demonstrated and the author (SH) walks his talk. However, I'm thinking to wedge something TDDish between doctest and unittest that's just the engaged coder testing her own module in top-level run mode (versus importing). It's one of those delegating of responsibility things that a module should have some standalone behaviors to model / demo what it brings to the table. To that end, a structure like: def _test( ): """ testing code goes here, TDD is your friend """ if __name__ == "__main__": _test( ) is considered "good to go". How does this support the "write tests first" philosophy? Well, imagine having this class: class Farm: def __init__(self, rows=8, columns=8, bg="*"): self.h = rows self.w = columns self.bg = bg # background character self.tractors = [] # like Snake or Dog stomach self.field = [list(bg*self.w) for x in range(self.h)] # model self.framenumber = 0 self.trace = [] def render(self): display="" for line in self.field: display += "".join(line)+"\n" return display # view __str__ = render def __repr__(self): return "Farm({},{}) @ {}".format(self.w, self.h, id(self)) It basically builds an M x N array of stars, and now you want to add the feature that you can peek or poke to that array using a FORTRAN-like syntax i.e. >>> myfarm = Farm(10,20) >>> myfarm(3, 5) = "@" will "plant" a "@" in row 3 column 5 of the data structure, named self.field. The coder would simply embed this expected feature in _test: def _test(): myfarm = Farm(10,20) # before picture print(myfarm) myfarm(3, 5) = "@" # after picture print(myfarm) It's clear to the coder what's expected, so there's the test. Now the goal is to add the minimum code to Farm that makes this work. Example (continued): class Farm: # << code already shown >> def __getitem__(self, key): # from arr4.py "Returns the appropriate element for a two-element subscript tuple." r, c = key return self.field[r][c] # from arr4.py def __setitem__(self, key, value): "Sets the appropriate element for a two-element subscript tuple." r, c = key self.field[r][c] = value Run the module top-level, triggering _test, and do so again and again, as contingencies and corner cases get tested. Leave a representative set of tests behind as evidence of your audit. You may write a more formal unittesting framework later, but there's no guarantee that's something to release with the module. The _test( ) function serves as an "on board payload" while the unittest framework stays behind "near the launch pad". The goal is to put the learner in the role of Quality Assurance tester, at least at first. Eat your own dog food. Keep the code to be tested and the tester code together, but that doesn't have to mean doctest. Kirby -------------- next part -------------- An HTML attachment was scrubbed... URL: From kb1pkl at aim.com Tue May 10 04:09:52 2011 From: kb1pkl at aim.com (Corey Richardson) Date: Mon, 09 May 2011 22:09:52 -0400 Subject: [Edu-sig] Game of Life in Sketchup; unittesting and TDD (pedagogy) In-Reply-To: References: <4DC88FB0.300@aim.com> Message-ID: <4DC89E70.6000008@aim.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 05/09/2011 09:46 PM, Kirby Urner wrote: > Run the module top-level, triggering _test, and do so again and again, > as contingencies and corner cases get tested. Leave a representative > set of tests behind as evidence of your audit. You may write a more > formal unittesting framework later, but there's no guarantee that's > something to release with the module. The _test( ) function serves > as an "on board payload" while the unittest framework stays behind > "near the launch pad". > > The goal is to put the learner in the role of Quality Assurance tester, > at least at first. Eat your own dog food. Keep the code to be tested > and the tester code together, but that doesn't have to mean doctest. I really like that approach, I think I'll start using it myself! Thanks for imparting your wisdom. And about the Game of Life: I'm starting to pick up a little VBA (eugh it's gross) and plan on implementing (if I can, of course) the Game of Life in an excel spreadsheet! Now that I think about it, I wonder if libreoffice has scripting and what it is... - -- Corey Richardson -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.17 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBAgAGBQJNyJ5wAAoJEAFAbo/KNFvpZYsH/16gHa2rM2hrp47P+g++arQ0 wRf1hSdbCfIZwoKXHKxL2cPgtMqwACZrYt2+eBgnu0aRNZBujXIS76ITd6qekSic Hrj3kx6ZpiE5RRnb1OyXbcMWVCF6nI540t348nCdutr6edytBSlQ45vyKpqS+los Q3QRwvQi0cj+go1xodutktR5pvA16shCpx8CdGcIX8RRTRjTvVi/CkhMO3zHK9qT 06wRuYa3bveR86xnOHyhHgtj4wBtf8ip9bnhZTXEQlAdPOhyvAh8KmEpwlpqq/fj tOAexh1hpwohXBOTZaSjiTF+/JwglP77XgQ8rcmHFkIomwKxG3LO6YHnHcDIxGc= =LhOj -----END PGP SIGNATURE----- From kirby.urner at gmail.com Sun May 15 06:35:07 2011 From: kirby.urner at gmail.com (kirby urner) Date: Sat, 14 May 2011 21:35:07 -0700 Subject: [Edu-sig] More cogitations on group theory... Message-ID: More cogitations on group theory... You get these fads, gripping at the time, that leave legacy traces. In New Math, we got imprinted with some Theory of Sets. Some scoff at that now, say it was just notation: intersection, union, subset, element of... taught to grade schoolers. Parents were agog. This was 1960s or so. A lot of it stayed. Singapore Math, favored by many conservatives (e.g. Mathematically Correct with ties to Cal State) still has it. Converting among bases suffered though, during the Great Retaliation. So-called "space age math" was hated and feared by the peasantry. NASA was given no interesting missions, boost phase was outsourced. Orlando engineering families went to work for The Mouse instead. http://www.google.com/search?hl=en&biw=1920&bih=948&gbv=2&tbm=isch&aq=f&aqi=&oq=&q=venn%20intersection%20%22new%20math%22 http://bit.ly/kWlclB (compressed version of above) (I scooped up several of mine in the above in this swoop through Google's data space, might be fun to pick out which ones... **). In Python, we have the set type, and it's important. It has to share the limelight though, and comes off almost as a subspecies of dict, a dict with keys, but no values. What a concept. set tends to come later in the Pythonista's learning career, though at OST it's still pretty early, definitely in the first unit. But then we're pretty steep, with MySQL and GUI programming in unit 2. Group Theory, like Clifford Algebra, is one of those things a small cadre thought might be taught to high schoolers, in some Jetsons-style science fiction future sponsored by Quaker Oats or one of those Breakfasts of Champions. I was an ardent member of this cast and to this day know how to wave the flag when called upon. Core to the idea of a group is a set of permutations, easily modeled as a Python dict. A permutation, or perm for short, is a complete swap of some finite set (no dupes), such that the original list maps to a random.shuffle of a mirror. That's what we implement in permworld.PermDNA, one of the early bird perm factories in this particular Level 4 curriculum. >>> ================================ RESTART ================================ >>> import OST >>> from OST.permworld import PermDNA, PermCell >>> from OST.permutils import cyclic, anticyclic >>> p = PermDNA() >>> thecell = PermCell(p) >>> antibody = ~thecell >>> voter = thecell("Eating transcriptionase for breakfast and spitting back collogen") >>> voter # enciphered ballot 'Elndpscnglpkvgdjndbplkrcfbgcagrleflknclpxckjdnndpscalvecvbzzbsrp' >>> antibody(voter) # decryption key per ~ operator, __invert__ in PermCell 'Eating transcriptionase for breakfast and spitting back collogen' Why go to all this trouble, why not just work with integers (which form various finite groups in upcoming lessons)? Answer: operator overloading. There's no point overloading +, *, ** etc. where integers are concerned. The operators are already defined. With perm objects, or PermCells as we call them (permDNA incepted) you still need to write that __mul__ operator, and that __div__ which is "multiply by the multiplicative inverse of." >>> thecell PermCell: (('a', 'l', 'z', 'w', 'h', ' ', 'c', 'v', 'q', 'y', 't', 'n', 'p', 'j', 'm', 'i', 'd', 'x', 'o', 'b'), ('e', 'r', 'g', 's', 'k'), ('f',), ('u',)) >>> antibody PermCell: (('a', 'b', 'o', 'x', 'd', 'i', 'm', 'j', 'p', 'n', 't', 'y', 'q', 'v', 'c', ' ', 'h', 'w', 'z', 'l'), ('e', 'k', 's', 'g', 'r'), ('f',), ('u',)) >>> identity = thecell * antibody >>> identity PermCell: (('a',), (' ',), ('c',), ('b',), ('e',), ('d',), ('g',), ('f',), ('i',), ('h',), ('k',), ('j',), ('m',), ('l',), ('o',), ('n',), ('q',), ('p',), ('s',), ('r',), ('u',), ('t',), ('w',), ('v',), ('y',), ('x',), ('z',)) >>> print(OST.permutils.__doc__) permutils.py 1.1 (gpl) OST / Python 4 http://www.gnu.org/software/gsl/manual/html_node/Permutations-in-cyclic-form.html is the kind of thing we're thinking. __div__ has not been implemented and so would be a student project, just as __setattr__ and __getarr__ might be defined on a reworked farmworld.py (free and open source, just like MIT courseware -- what all of the better schools are doing it seems, putting their cards on the table). Sorry for so much technical jargon, but I'm thinking to attract others with experience in this area. We've got cyclic notation going, modeled on the J language and one of the GNU projects. The isomorphism of a perm expressed as a dict, and a perm expressed as a tuple of tuples, and the algorithms for going both directions, is one of the pillars of permworld, as you might expect. Kirby (sm) ghost ship productions, usa.or.pdx.4d (dba pending) ** http://controlroom.blogspot.com/2007/10/portland-radio.html (because of surrounding posts I suppose -- the link was to these pictures from Portland's KBOO radio station). Another couple: http://www.grunch.net/synergetics/ncmtmemo.html More obviously (totally about the New Math): http://controlroom.blogspot.com/2007/10/recalling-sputnik.html From echerlin at gmail.com Sun May 15 07:33:49 2011 From: echerlin at gmail.com (Edward Cherlin) Date: Sun, 15 May 2011 01:33:49 -0400 Subject: [Edu-sig] More cogitations on group theory... In-Reply-To: References: Message-ID: On Sun, May 15, 2011 at 00:35, kirby urner wrote: > More cogitations on group theory... The fundamental idea of a group can be introduced to preschoolers. I am writing and programming lessons on this topic, which I will test on children, and report to you. My first example will be a triangle with sides in three colors. How many ways can you place that in a triangular frame? How many moves are possible? Can you reverse any move? Do the moves associate? (That is, is doing A and B, and then C, the same as doing A, and then B and C?) Well, there you are, all of the group axioms. There is an associative function with inverses. Then we look at other symmetries of other shapes, and find that the positions and the moves match up, and we always get a group, even if it is the trivial group for a completely asymmetric shape: the group with only one element. Then infinite groups, like the symmetries of a circle or sphere. Then permutations. Every finite group is a subset of a permutation group. I'll leave matrices for a later grade. There is a very pleasant book on group theory for non-mathematicians, which uses Rubik's cube for examples throughout. I have it bookmarked on Amazon, but I am going to finish this e-mail and go to bed rather than look it up tonight. Groupoids, categories, rings (clock time), fields (modular arithmetic), vector spaces, and algebras require a bit more thought, but I am sure that they can be done. Of course, in every case I am talking about extracting and presenting the fundamental ideas, and leaving proofs, notations, and all but the simplest calculations for later. > You get these fads, gripping at the time, that leave legacy traces. > In New Math, we got imprinted with some Theory of Sets. > > Some scoff at that now, say it was just notation: ?intersection, > union, subset, element of... taught to grade schoolers. ?Parents > were agog. ?This was 1960s or so. > > A lot of it stayed. ?Singapore Math, favored by many conservatives > (e.g. Mathematically Correct with ties to Cal State) still has it. > > Converting among bases suffered though, during the Great > Retaliation. ?So-called "space age math" was hated and feared > by the peasantry. ?NASA was given no interesting missions, > boost phase was outsourced. ?Orlando engineering families > went to work for The Mouse instead. > > http://www.google.com/search?hl=en&biw=1920&bih=948&gbv=2&tbm=isch&aq=f&aqi=&oq=&q=venn%20intersection%20%22new%20math%22 > > http://bit.ly/kWlclB ?(compressed version of above) > > (I scooped up several of mine in the above in this swoop through > Google's data space, might be fun to pick out which ones... **). > > In Python, we have the set type, and it's important. ?It has to > share the limelight though, and comes off almost as a subspecies > of dict, a dict with keys, but no values. > > What a concept. > > set tends to come later in the Pythonista's learning career, though > at OST it's still pretty early, definitely in the first unit. ?But then > we're pretty steep, with MySQL and GUI programming in unit 2. > > Group Theory, like Clifford Algebra, is one of those things a > small cadre thought might be taught to high schoolers, in > some Jetsons-style science fiction future sponsored by Quaker > Oats or one of those Breakfasts of Champions. > > I was an ardent member of this cast and to this day know > how to wave the flag when called upon. > > Core to the idea of a group is a set of permutations, easily > modeled as a Python dict. ?A permutation, or perm for short, > is a complete swap of some finite set (no dupes), such that > the original list maps to a random.shuffle of a mirror. > > That's what we implement in permworld.PermDNA, one of > the early bird perm factories in this particular Level 4 curriculum. > >>>> ================================ RESTART ================================ >>>> import OST >>>> from OST.permworld import PermDNA, PermCell >>>> from OST.permutils import cyclic, anticyclic >>>> p = PermDNA() >>>> thecell = PermCell(p) >>>> antibody = ~thecell >>>> voter = thecell("Eating transcriptionase for breakfast and spitting back collogen") >>>> voter # enciphered ballot > 'Elndpscnglpkvgdjndbplkrcfbgcagrleflknclpxckjdnndpscalvecvbzzbsrp' >>>> antibody(voter) ?# decryption key per ~ operator, __invert__ in PermCell > 'Eating transcriptionase for breakfast and spitting back collogen' > > Why go to all this trouble, why not just work with integers > (which form various finite groups in upcoming lessons)? > Answer: ?operator overloading. ?There's no point overloading > +, *, ** etc. where integers are concerned. ?The operators are > already defined. ?With perm objects, or PermCells as we > call them (permDNA incepted) you still need to write that > __mul__ operator, and that __div__ which is "multiply by > the multiplicative inverse of." > >>>> thecell > PermCell: (('a', 'l', 'z', 'w', 'h', ' ', 'c', 'v', 'q', 'y', 't', > 'n', 'p', 'j', 'm', 'i', 'd', 'x', 'o', 'b'), ('e', 'r', 'g', 's', > 'k'), ('f',), ('u',)) >>>> antibody > PermCell: (('a', 'b', 'o', 'x', 'd', 'i', 'm', 'j', 'p', 'n', 't', > 'y', 'q', 'v', 'c', ' ', 'h', 'w', 'z', 'l'), ('e', 'k', 's', 'g', > 'r'), ('f',), ('u',)) >>>> identity = thecell * antibody >>>> identity > PermCell: (('a',), (' ',), ('c',), ('b',), ('e',), ('d',), ('g',), > ('f',), ('i',), ('h',), ('k',), ('j',), ('m',), ('l',), ('o',), > ('n',), ('q',), ('p',), ('s',), ('r',), ('u',), ('t',), ('w',), > ('v',), ('y',), ('x',), ('z',)) >>>> print(OST.permutils.__doc__) > > permutils.py ?1.1 > (gpl) OST / Python 4 > http://www.gnu.org/software/gsl/manual/html_node/Permutations-in-cyclic-form.html > > is the kind of thing we're thinking. ?__div__ has not been > implemented and so would be a student project, just as > __setattr__ and __getarr__ might be defined on a > reworked farmworld.py (free and open source, just > like MIT courseware -- what all of the better schools > are doing it seems, putting their cards on the table). > > Sorry for so much technical jargon, but I'm thinking to > attract others with experience in this area. ?We've got > cyclic notation going, modeled on the J language and one > of the GNU projects. ?The isomorphism of a perm expressed > as a dict, and a perm expressed as a tuple of tuples, > and the algorithms for going both directions, is one of > the pillars of permworld, as you might expect. > > Kirby > > > (sm) ghost ship productions, usa.or.pdx.4d (dba pending) > > ** http://controlroom.blogspot.com/2007/10/portland-radio.html > (because of surrounding posts I suppose -- the link was to > these pictures from Portland's KBOO radio station). > > Another couple: > http://www.grunch.net/synergetics/ncmtmemo.html > > More obviously (totally about the New Math): > http://controlroom.blogspot.com/2007/10/recalling-sputnik.html > _______________________________________________ > Edu-sig mailing list > Edu-sig at python.org > http://mail.python.org/mailman/listinfo/edu-sig > -- Edward Mokurai (??/???????????????/????????????? ?) Cherlin Silent Thunder is my name, and Children are my nation. The Cosmos is my dwelling place, the Truth my destination. http://www.earthtreasury.org/ From kirby.urner at gmail.com Sun May 15 10:12:36 2011 From: kirby.urner at gmail.com (kirby urner) Date: Sun, 15 May 2011 01:12:36 -0700 Subject: [Edu-sig] More cogitations on group theory... In-Reply-To: References: Message-ID: > Groupoids, categories, rings (clock time), fields (modular > arithmetic), vector spaces, and algebras require a bit more thought, > but I am sure that they can be done. > That's perfect Ed. Good to hear for another die-hard "group theory for children" dude, a vanishing breed perhaps. My intended audience might actually be older people, including so-called "retirement community" students who have grand kids and want to have inter-generational topics. Many learned BASIC as kids (the Bill Gates generation). Another group you can massage into a field are integers multiplying modulo N, except not just any integers, only N's totatives. Back to permworld and Guido's exceedingly simple implementation of Euclid's Algorithm. >>> def gcd(a,b): while b: a , b = b, a % b return a >>> gcd(12, 4) 4 >>> gcd(12, 5) 1 >>> totatives12 = [m for m in range(12) if gcd(m, 12) == 1 ] >>> totatives12 [1, 5, 7, 11] >>> from random import choice >>> (choice(totatives12) * choice(totatives12)) % 12 11 >>> (choice(totatives12) * choice(totatives12)) % 12 1 >>> (choice(totatives12) * choice(totatives12)) % 12 5 Asserting closer (group property): >>> if (choice(totatives12) * choice(totatives12)) % 12 in totatives12: print (True) True >>> if (choice(totatives12) * choice(totatives12)) % 12 in totatives12: print (True) True >>> if (choice(totatives12) * choice(totatives12)) % 12 in totatives12: print (True) True If the target number is prime instead of composite (e.g. 23 instead of 12), then you have field properties, not just group properties i.e. + is closed as much as * is. You'll find me ranting on mathfuture how high schools bleep over any opportunity to introduce "totative" or "totient" in favor an an exclusive "factor tree" based approach to gcd. That made more sense before RSA was in every web browser. In a "how things work" curriculum, one would wish for more computer literacy. http://groups.google.com/group/mathfuture/msg/11005d0c9dc9eba2 (I've gotten more correspondence from Milo -- he wants to make sure we all know that Turing at Bletchley Park did *not* solve the German U-boat 5-rotor puzzle, doesn't like how much credit Turing gets). I'd like want to use John Zelle's graphics.py in the module where we draw some Wolfram checkerboard of black and orange rectangles ala New Kind of Science (NKS). We were doing that back in February 2007. http://mail.python.org/pipermail/edu-sig/2007-February/007736.html The new version gets Conway's Game of Life from the same "turtle" (called a "tractor" in farmworld, but the same idea, transferred to all-ASCII waves of grain). Even Mandelbrot is rendered in ASCII "tractor art": http://mybizmo.blogspot.com/2011/05/lesson-planning.html These are ancient threads as far as edu-sig is concerned. We've always been trendy around here. :) > Of course, in every case I am talking about extracting and presenting > the fundamental ideas, and leaving proofs, notations, and all but the > simplest calculations for later. > Of course. I've got an older bunch but this isn't a course about Group Theory, it's a course about learning to program in the Python computer language, with a backdrop of standard Computer Science courses (Euclid's Algorithm chief among them, at least here on edu-sig). Kirby From echerlin at gmail.com Sun May 15 18:13:39 2011 From: echerlin at gmail.com (Edward Cherlin) Date: Sun, 15 May 2011 12:13:39 -0400 Subject: [Edu-sig] More cogitations on group theory... In-Reply-To: References: Message-ID: On Sun, May 15, 2011 at 04:12, kirby urner wrote: >> Groupoids, categories, rings (clock time), fields (modular >> arithmetic), vector spaces, and algebras require a bit more thought, >> but I am sure that they can be done. I mentioned a few Lie Groups, but I omitted the name. Toposes, topologies, tilings, and fractals would be interesting to investigate, too. > That's perfect Ed. ?Good to hear for another die-hard "group > theory for children" dude, a vanishing breed perhaps. It's just a fancy name for symmetry. MC Frontalot: Why do mirrors reverse left and right, but not up and down? John Hodgeman: They're just lazy. They could if they felt like it. Yeah, so what's really going on with mirrors? MC Frontalot is a nerdcore hiphop artist, and John Hodgeman is the author of More Information than You Require. He was also the PC in the Mac ads, and is sometimes on The Daily Show. > My intended audience might actually be older people, including > so-called "retirement community" students who have grand kids > and want to have inter-generational topics. ?Many learned > BASIC as kids (the Bill Gates generation). > > Another group you can massage into a field are integers > multiplying modulo N, except not just any integers, only > N's totatives. ?Back to permworld and Guido's exceedingly > simple implementation of Euclid's Algorithm. > >>>> def gcd(a,b): > ? ? ? ?while b: > ? ? ? ? ? ? ? ?a , b = b, a % b > ? ? ? ?return a > >>>> gcd(12, 4) > 4 >>>> gcd(12, 5) > 1 >>>> totatives12 = [m for m in range(12) if gcd(m, 12) == 1 ] >>>> totatives12 > [1, 5, 7, 11] >>>> from random import choice > >>>> (choice(totatives12) * choice(totatives12)) % 12 > 11 >>>> (choice(totatives12) * choice(totatives12)) % 12 > 1 >>>> (choice(totatives12) * choice(totatives12)) % 12 > 5 > > Asserting closer (group property): > >>>> if (choice(totatives12) * choice(totatives12)) % 12 in totatives12: print (True) > > True >>>> if (choice(totatives12) * choice(totatives12)) % 12 in totatives12: print (True) > > True >>>> if (choice(totatives12) * choice(totatives12)) % 12 in totatives12: print (True) > > True > > If the target number is prime instead of composite (e.g. 23 > instead of 12), then you have field properties, not just group > properties i.e. + is closed as much as * is. > > You'll find me ranting on mathfuture how high schools bleep > over any opportunity to introduce "totative" or "totient" in > favor an an exclusive "factor tree" based approach to > gcd. ?That made more sense before RSA was in every > web browser. ?In a "how things work" curriculum, one > would wish for more computer literacy. > > http://groups.google.com/group/mathfuture/msg/11005d0c9dc9eba2 > (I've gotten more correspondence from Milo -- he wants to > make sure we all know that Turing at Bletchley Park did > *not* solve the German U-boat 5-rotor puzzle, doesn't like > how much credit Turing gets). > > I'd like want to use John Zelle's graphics.py in the module > where we draw some Wolfram checkerboard of black > and orange rectangles ala New Kind of Science (NKS). > We were doing that back in February 2007. > > http://mail.python.org/pipermail/edu-sig/2007-February/007736.html > > The new version gets Conway's Game of Life from the > same "turtle" (called a "tractor" in farmworld, but the > same idea, transferred to all-ASCII waves of grain). > Even Mandelbrot is rendered in ASCII "tractor art": > > http://mybizmo.blogspot.com/2011/05/lesson-planning.html > > These are ancient threads as far as edu-sig is concerned. > We've always been trendy around here. :) > >> Of course, in every case I am talking about extracting and presenting >> the fundamental ideas, and leaving proofs, notations, and all but the >> simplest calculations for later. >> > > Of course. ?I've got an older bunch but this isn't a course > about Group Theory, it's a course about learning to > program in the Python computer language, with a backdrop > of standard Computer Science courses (Euclid's Algorithm > chief among them, at least here on edu-sig). > > Kirby > _______________________________________________ > Edu-sig mailing list > Edu-sig at python.org > http://mail.python.org/mailman/listinfo/edu-sig > -- Edward Mokurai (??/???????????????/????????????? ?) Cherlin Silent Thunder is my name, and Children are my nation. The Cosmos is my dwelling place, the Truth my destination. http://www.earthtreasury.org/ From kurner at oreillyschool.com Sun May 15 22:52:02 2011 From: kurner at oreillyschool.com (Kirby Urner) Date: Sun, 15 May 2011 13:52:02 -0700 Subject: [Edu-sig] More cogitations on group theory... In-Reply-To: References: Message-ID: On Sun, May 15, 2011 at 9:13 AM, Edward Cherlin wrote: > On Sun, May 15, 2011 at 04:12, kirby urner wrote: > >> Groupoids, categories, rings (clock time), fields (modular > >> arithmetic), vector spaces, and algebras require a bit more thought, > >> but I am sure that they can be done. > > I mentioned a few Lie Groups, but I omitted the name. Toposes, > topologies, tilings, and fractals would be interesting to investigate, > too. > > Yes, it's nice to have this back office lingo to go with the work, like a garnish. In our case, the group theory is a kind of banter, a chance to say CAIN (closure associativity inverse neutral) and wink at someone, because you both went to that same summer of code or whatever barcamp. I've noticed the MBA types are tracked away from sounding too much like computer scientists, which is where this curriculum is refreshing. Most of our students are already employed (an educated guess) and are using some of their free time to invest in new skills. This is the demographic with the best access. Nursing homes, penitentiaries, and high schools, tend to lag, though I could see those numbers picking up in more liberal countries like Sweden. But then who speaks Swedish in California... distance education gets confusing. One of my latest live gigs was a room full of PhDs in Baltimore. No one there needed any more "academic credit" and yet they all wanted to learn Python. They weren't from the same specialties always (quite a few were in instrumentation for Hubble type spacecraft). Putting a group theory spin on it, having a few polyhedrons (literally, in my carry-on) helped lighten the atmosphere as I was clearly not going to talk down to them, nor bore them with too many examples about money (a common mistake of business class teachers, when confronted with a science-minded audience (hence names like PermCell and PermDNA)). > > That's perfect Ed. Good to hear for another die-hard "group > > theory for children" dude, a vanishing breed perhaps. > > It's just a fancy name for symmetry. > > MC Frontalot: Why do mirrors reverse left and right, but not up and down? > John Hodgeman: They're just lazy. They could if they felt like it. > > Yeah, so what's really going on with mirrors? > > MC Frontalot is a nerdcore hiphop artist, and John Hodgeman is the > author of More Information than You Require. He was also the PC in the > Mac ads, and is sometimes on The Daily Show. > > Sounds like I'll find lots of Youtubes of this guy. We've already discussed "demented". I'd let PeeWee Herman teach Python if he wanted, though I think some of his talking furniture items might be better at it. Kirby -------------- next part -------------- An HTML attachment was scrubbed... URL: From aharrin at luc.edu Tue May 17 02:12:29 2011 From: aharrin at luc.edu (Andrew Harrington) Date: Mon, 16 May 2011 19:12:29 -0500 Subject: [Edu-sig] place for 800x600 python videos Message-ID: I'm making a bunch of videos for my Hands-on Python Tutorial, in preparation for teaching online this summer. The university's preferred place to put stuff, and which accepts videos of any dimensions, is iTunes U, but that is not Linux friendly and generally a pain. Where could such 800x600 mp4 videos be posted? I am talking about maybe 100 2-12 minute videos, 3-12 MB each, totaling around 1GB. -- Dr. Andrew N. Harrington Computer Science Department Loyola University Chicago 512B Lewis Towers (office) Snail mail to Lewis Towers 416 820 North Michigan Avenue Chicago, Illinois 60611 http://www.cs.luc.edu/~anh Phone: 312-915-7982 Fax: 312-915-7998 aharrin at luc.edu -------------- next part -------------- An HTML attachment was scrubbed... URL: From andre.roberge at gmail.com Tue May 17 02:20:01 2011 From: andre.roberge at gmail.com (Andre Roberge) Date: Mon, 16 May 2011 21:20:01 -0300 Subject: [Edu-sig] Fwd: place for 800x600 python videos In-Reply-To: References: Message-ID: Sorry - forgot to cc the edu-sig list. ---------- Forwarded message ---------- From: Andre Roberge Date: Mon, May 16, 2011 at 9:19 PM Subject: Re: [Edu-sig] place for 800x600 python videos To: Andrew Harrington Hi Andrew, On Mon, May 16, 2011 at 9:12 PM, Andrew Harrington wrote: > I'm making a bunch of videos for my Hands-on Python Tutorial, in > preparation for teaching online this summer. > > The university's preferred place to put stuff, and which accepts videos of > any dimensions, is iTunes U, but that is not Linux friendly and generally a > pain. > > Where could such 800x600 mp4 videos be posted? I am talking about maybe > 100 2-12 minute videos, 3-12 MB each, totaling around 1GB. > I would suggest http://showmedo.com/ . Andr? > > -- > Dr. Andrew N. Harrington > Computer Science Department > Loyola University Chicago > 512B Lewis Towers (office) > Snail mail to Lewis Towers 416 > 820 North Michigan Avenue > Chicago, Illinois 60611 > http://www.cs.luc.edu/~anh > Phone: 312-915-7982 > Fax: 312-915-7998 > aharrin at luc.edu > > _______________________________________________ > Edu-sig mailing list > Edu-sig at python.org > http://mail.python.org/mailman/listinfo/edu-sig > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From kurner at oreillyschool.com Tue May 17 02:21:03 2011 From: kurner at oreillyschool.com (Kirby Urner) Date: Mon, 16 May 2011 17:21:03 -0700 Subject: [Edu-sig] place for 800x600 python videos In-Reply-To: References: Message-ID: I know the owner of Python.tv which is one logical place. But I don't think it's mapped yet. What's the resolution of ShowMeDo? I have a bunch on there myself. Kirby On Mon, May 16, 2011 at 5:12 PM, Andrew Harrington wrote: > I'm making a bunch of videos for my Hands-on Python Tutorial, in > preparation for teaching online this summer. > > The university's preferred place to put stuff, and which accepts videos of > any dimensions, is iTunes U, but that is not Linux friendly and generally a > pain. > > Where could such 800x600 mp4 videos be posted? I am talking about maybe > 100 2-12 minute videos, 3-12 MB each, totaling around 1GB. > > -- > Dr. Andrew N. Harrington > Computer Science Department > Loyola University Chicago > 512B Lewis Towers (office) > Snail mail to Lewis Towers 416 > 820 North Michigan Avenue > Chicago, Illinois 60611 > http://www.cs.luc.edu/~anh > Phone: 312-915-7982 > Fax: 312-915-7998 > aharrin at luc.edu > > _______________________________________________ > Edu-sig mailing list > Edu-sig at python.org > http://mail.python.org/mailman/listinfo/edu-sig > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From Pippa.Buchanan at gmail.com Wed May 18 13:19:42 2011 From: Pippa.Buchanan at gmail.com (Pippa Buchanan) Date: Wed, 18 May 2011 13:19:42 +0200 Subject: [Edu-sig] School of Webcraft (Mozilla and P2PU) - Invitation to advise on our Python Badge criteria Message-ID: Dear members of the Python Edu SIG, School of Webcraft is a community offering and developing a set of peer-driven courses on open web development freely available via Peer 2 Peer University(P2PU) in partnership with Mozilla . We've had a number of Python courses and study groups set up within School of Webcraft. We'd like to invite the Python Edu SIG to help improve these popular offerings and in particular to help us develop the criteria for peer-assesment on Python competencies. Together with the Open Badges project we're developing an assessment and badge pilot with the goalof providing alternative pathways to certification and credentialing. Learners can take a series of peer-reviewed assessments to demonstrate their skills, completing assessment successfully earns them badges they can share with stakeholders such as potential employers. Currently the badge pilot is available to School of Webcraft participants. We feel these efforts will not only further the impact of informal and peer learning channels, but also give us the opportunity to be further innovate with assessments. We are working hard to create assessments that are authentic and relevant to web developers, to capitalize on their existing portfolio where possible and to inspire continued learning and growth during the assessment process. Assessments we have piloted so far have avoided standard multiple choice, but instead are based around challenges or exercises and narratives, with an aligned rubric to assess against. Here are two examples of two different levels of assessments we are currently running: - Javascript basic: http://badges.p2pu.org/questions/1/javascript-basic-badge-challenge - Javascript expert: http://badges.p2pu.org/questions/2/javascript-expert-badge-challenge We are writing you to enlist your help in creating/identifying additional assessments for both Beginners and Advanced Python badges for the second phase of the badge pilot. By helping us out on this pilot you'll be developing tangible and meaningful ways for employers and Python developers to measure and identify their skills beyond the vague "rockstar" status. In recognition of involvement in the pilot the Python Edu SIG will be listed and linked as advisors for the relevant badges. We would benefit greatly from your insight into what the key elements of a rubric should be, as well as ideas around potential challenges or exercises. The model we have been using is: - Assessment challenge/instructions - Rubric to assess against (aka, "A Python Expert is someone who...." Again, please see the links above as examples of the model we have been currently using. We are not adverse to other ideas or models, but we do want to continue to strive for authentic and highly relevant assessments wherever possible. We are moving very quickly with this so please let us know if you have some ideas you can pass along. Thanks in advance for your help with this important effort. Erin Knight , Badge and Assessment Lead, Mozilla and P2PU and Pippa Buchanan , School of Webcraft Community Lead, Mozilla and P2PU To become further involved with the School of Webcraft please join our discussion list or create or participate in study groups or courses. -------------- next part -------------- An HTML attachment was scrubbed... URL: From mpaul213 at gmail.com Wed May 18 19:11:32 2011 From: mpaul213 at gmail.com (michel paul) Date: Wed, 18 May 2011 10:11:32 -0700 Subject: [Edu-sig] lychrel numbers Message-ID: I just discovered lychrel numbers. See http://www.p196.org/ Interesting. No one knows if they exist. There are candidates that have not produced palindromes despite massive computational investigation, but so far no proofs one way or the other. This is a great class activity, similar to exploring the 6174pattern that Kirby mentioned a few years ago. How would we go about finding such things? What tools do we need? Well, let's see - we need to be able to reverse the digits of a number, we need to be able to test a number to see if it's a palindrome, we need a way to count the number of iterations required to produce a palindrome, etc. I brought this up in my computational classes yesterday, and I was pleased to see what some of the kids started to do. A couple of them started looking for patterns between the lychrel candidates, noting their distances from each other and noting that if n is a candidate then obviously reverse(n) is as well. And one kid pointed out that this is not a property of the numbers themselves but of the base 10 representations of the numbers as lists of digits. So in binary, we'd get a different set of lychrel candidates. - Michel -- ================================== "What I cannot create, I do not understand." - Richard Feynman ================================== "Computer science is the new mathematics." - Dr. Christos Papadimitriou ================================== -------------- next part -------------- An HTML attachment was scrubbed... URL: From da.ajoy at gmail.com Fri May 20 04:46:41 2011 From: da.ajoy at gmail.com (Daniel Ajoy) Date: Thu, 19 May 2011 21:46:41 -0500 Subject: [Edu-sig] The role of programming (30 min lecture) Message-ID: The role of programming http://video.google.com/videoplay?docid=-2726904509434151616# tl;dr: because math notation is impressionistic, not precise. Also, has to reference to Mindstorms at the end. Daniel From kirby.urner at gmail.com Sat May 21 02:01:33 2011 From: kirby.urner at gmail.com (kirby urner) Date: Fri, 20 May 2011 17:01:33 -0700 Subject: [Edu-sig] pythonic ethnography Message-ID: I'm planning another class for Saturday Academy. Last year the theme for the whole convergence (at Reed College) was "a time line", with students bouncing from Egyptian Math to Neolithic Math to my more futuristic (after now) Martian Math (with a science fiction theme). This time there's a "global networking" theme and I'm looking at archeology and ethnography as disciplines that knit people together -- and use math, logic, deductive skills. Ethnography from some Future Time (translated from not-English): Python Nation flourished in the late Plasticene (the age of plastics), contemporary with Monty Python and Peter Sellers. Its language has come down to us largely unchanged. Philosophical debates have swirled in its wake, linking Russell's type-based approach to Logic (cite Ray Monk) with post Vannevar Bush machine-based Logic (the basis of our MEMEX etc). The idea of virtual machines was already well established (cite 'The Rise of Java in Post Anglo America' by Cuervo & Nash, 2033). Python, the language, was built around some primitive types, namely int, str, dict, tuple, list, float, complex and a smattering of others. Natives also had access to set, decimal, and of course the higher level structures we associate with Python's continued use in biomolecular science and genomics (you will encounter the Python lineage outside these disciplines too of course, perhaps as Zython or Py5). In this logical landscape, a dict type could eat other objects, including of other types, through a lexical "mouth" ( ) contrived in ASCII, a descendant of the mathematical notation of Russell. Objects stuffed through a mouth were called "args" relating to the human function of "arguing" that mouths often engage in (also: ethnic pirates were known to say "arrrgh" a lot, in addition to being argumentative). 'args' would be "met at the gate" (between scopes) by params (parameters), in ways generally familiar to computer language humanists, though the specifics were (and are) a subject of some wonder.** Example syntax (pillar str) str.title(arg) str.capitalize(arg) str.endswith(arg, arg) ... Note how these methods attach to one of the Primitive Pillars upholding the ancestral "Superstructure of Objects" (as some have translated the Anglophone literature of the late Plasticene). dict.__setitem__(inst, key, value) was one of the "rib cage" methods (cite Kirbinalia Vol 3) delivering dict type services to the surrounding ecosystem. inst would need to be recognizably of the dict type, in order for __setitem__ to perform its services. Example: class Dict(dict): """ OST skunkworks: didactic dict (Holden, Urner) """ def __init__(self,*args, **kwargs): dict.__init__(self,*args, **kwargs) self.peeks = 0 def __getitem__(self, key): try: self.peeks += 1 # charge 1 peek return dict.__getitem__(self,key) except KeyError: self.peeks = max(self.peeks-1, 0) # refund policy print("No such animal") # warning: loud mouth raise def __repr__(self): self.peeks += 2 # penalty! return "No paparazzi!" # minimal security @property # to observe it is to change it (Heisenberg) def hits(self): "hit counter for dict-like object" self.peeks += 1 return self.peeks >>> thedict = Dict(key='value') >>> thedict.hits 1 >>> thedict['Guido'] = thedict.get('Guido',0)+1 >>> thedict No paparazzi! >>> thedict.hits 4 >>> thedict['Britney'] # contemporary of Guido's No such animal Traceback (most recent call last): File "", line 1, in thedict['Britney'] File "", line 12, in __getitem__ return dict.__getitem__(self,key) KeyError: 'Britney' >>> thedict.hits 5 >>> str(thedict) 'No paparazzi!' >>> thedict.hits 8 >>> == martian math chronicles === ** "birth" on the other hand, was signified with the vaginal ( ) placed after a Type such as dict( ), though again with possible args, the birth canal's moving line assembly potentially building ("constructing") instance level characteristics such as skin and/or eye color. Birth canal named __init__ in by the Pythonista's Nation's chief language architect, in keeping with the linguistic aesthetics of this early Logic (post MMX, circa John Lennon, for those still confused about the time line). From LAZARM at bialik.vic.edu.au Sat May 21 14:16:06 2011 From: LAZARM at bialik.vic.edu.au (Michelle Lazarow) Date: Sat, 21 May 2011 12:16:06 +0000 Subject: [Edu-sig] practice exercises and solutions Message-ID: Hi, Does anyone have python exercises and solutions appropriate for high school students they would be willing to share? Thanks, Michelle -------------- next part -------------- An HTML attachment was scrubbed... URL: From kurner at oreillyschool.com Sat May 21 22:04:49 2011 From: kurner at oreillyschool.com (Kirby Urner) Date: Sat, 21 May 2011 13:04:49 -0700 Subject: [Edu-sig] practice exercises and solutions In-Reply-To: References: Message-ID: I've got tons of free stuff on-line that I use with high-school aged or adults (who tend to be slower, if better informed). However, not much of it fits the exercises + solutions format. If I were you' I'd invest in a copy of Mathematics for the Digital Age and Programming in Python by Litvin & Litvin, Skylit Publishing ] Several schools use it. Phasing out a lot of the pre-computer math to make room for this better stuff is proving easy in some niches (impossible in others -- twas ever thus). Kirby On Sat, May 21, 2011 at 5:16 AM, Michelle Lazarow wrote: > Hi, > Does anyone have python exercises and solutions appropriate for high school > students they would be willing to share? > Thanks, > Michelle > > _______________________________________________ > Edu-sig mailing list > Edu-sig at python.org > http://mail.python.org/mailman/listinfo/edu-sig > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From gregor.lingl at aon.at Sat May 21 23:11:17 2011 From: gregor.lingl at aon.at (Gregor Lingl) Date: Sat, 21 May 2011 23:11:17 +0200 Subject: [Edu-sig] superformula, generators Message-ID: <4DD82A75.8060604@aon.at> Hi all, recently I stumbled (once more) over a posting by our friend Daniel Ajoy about the superformula (I think it was in a Logo-Forum): http://en.wikipedia.org/wiki/Superformula On the other side Kirby wrote interesting suggestions about using generators. Now, weekend, bad weather, some sparetime, I assembled an implementation of a superformula-viewer using pygame. It runs with Python 2.6 or higher, also 3.x, of course You'll find it here for download: http://dl.dropbox.com/u/2016850/superformula.py or appended (which sometimes / for some of you) doesn't work well depending on the browser or whatever. The script uses generators for generating the pointlists of the graph of the superformula and also for generating colors for the segments of the graph-area. Morover I've prepared a q&d slider class, which possibly doesn't use the canonical way of processing events in pygame but works fine for this application. Critical comments and feedback and also questions, of course, are welcome. Perhaps someone is willing to amend the docstrings, which suffer from my clumsy English and could well be more clear. Amendments of the code, espercially ones, which make it more readable and easier to understand, also. Useful for classroom use? Perhaps to difficult? Best regards, Gregor -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: superformula.py URL: From echerlin at gmail.com Sun May 22 02:57:22 2011 From: echerlin at gmail.com (Edward Cherlin) Date: Sat, 21 May 2011 20:57:22 -0400 Subject: [Edu-sig] superformula, generators In-Reply-To: <4DD82A75.8060604@aon.at> References: <4DD82A75.8060604@aon.at> Message-ID: There are a great many such parametric formulae, such as hypergeometric sequences and their sums. You can get very interesting results by plotting the roots of a polynomial as the coefficients vary, without ever letting two roots coincide. It is possible to generate all knots and links in this way, by letting the graph wrap around. Given * A parameter t in the range [0,1] * A polynomial P = ?a?x? for i in the range from 0 to n * Continuous but not necessarily differentiable complex-valued functions a?(t), with a?(0) = a?(1) for which P has no repeated roots at any value of t, we can take the graphs of the n complex roots of P for each t, graph them in three dimensions, and then topologically wrap the whole thing around into a donut, joining t = 0 and t = 1, where the roots are the same, but may be permuted. The following diagram must be viewed in a monospace font in order to make sense. _______ _____ \/ _______/\_____ On Sat, May 21, 2011 at 17:11, Gregor Lingl wrote: > Hi all, > > recently I stumbled (once more) over a posting by our friend > Daniel Ajoy about the superformula (I think it was in a Logo-Forum): > > http://en.wikipedia.org/wiki/Superformula > > On the other side Kirby wrote interesting suggestions > about using generators. > > Now, weekend, bad weather, some sparetime, I > assembled an implementation of a superformula-viewer > using pygame. It runs with Python 2.6 or higher, also > 3.x, of course > > You'll find it here for download: > > http://dl.dropbox.com/u/2016850/superformula.py > > or appended (which sometimes / for some of you) > doesn't work well depending on the browser or whatever. > > The script uses generators for generating the pointlists > of the graph of the superformula and also for generating > colors for the segments of the graph-area. > > Morover I've prepared a q&d slider class, which possibly > doesn't use the canonical way of processing events in > pygame but works fine for this application. > > Critical comments and feedback and also questions, of course, > are welcome. > > Perhaps someone is willing to amend the docstrings, > which suffer from my clumsy English and could well > be more clear. > > Amendments of the code, espercially ones, which make it > more readable and easier to understand, also. > > Useful for classroom use? Perhaps to difficult? > > Best regards, > Gregor > > > > _______________________________________________ > Edu-sig mailing list > Edu-sig at python.org > http://mail.python.org/mailman/listinfo/edu-sig > > -- Edward Mokurai (??/???????????????/????????????? ?) Cherlin Silent Thunder is my name, and Children are my nation. The Cosmos is my dwelling place, the Truth my destination. From carl at free.org.nz Mon May 23 01:33:30 2011 From: carl at free.org.nz (Carl Cerecke) Date: Mon, 23 May 2011 11:33:30 +1200 Subject: [Edu-sig] practice exercises and solutions In-Reply-To: References: Message-ID: codingbat.com Not perfect, but pretty good. Carl. On 22 May 2011 00:16, Michelle Lazarow wrote: > Hi, > Does anyone have python exercises and solutions appropriate for high school > students they would be willing to share? > Thanks, > Michelle > > _______________________________________________ > Edu-sig mailing list > Edu-sig at python.org > http://mail.python.org/mailman/listinfo/edu-sig > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jeff at elkner.net Tue May 31 22:59:37 2011 From: jeff at elkner.net (Jeff Elkner) Date: Tue, 31 May 2011 16:59:37 -0400 Subject: [Edu-sig] Anyone interested in discussing the turtle module? Message-ID: Hi All, I'm working on an introductory CS book using Python with the turtle module, but I'm finding the inability of turtle.Screen() to take screen size arguments to be a real pain. The screen size appears to depend on the screen size of the host environment, which means standardizing screen shots for the book becomes impossible. Any thoughts on this issue? It would be a huge help in promoting Python's use in education if we could make use of such a potentially fine module as the turtle module, but I'm finding it very difficult to write curriculum materials that use it since students don't have control over the turtle's screen in any easy to use way. Thanks! jeff elkner open book project http://openbookproject.net From jeff at elkner.net Tue May 31 23:30:15 2011 From: jeff at elkner.net (Jeff Elkner) Date: Tue, 31 May 2011 17:30:15 -0400 Subject: [Edu-sig] Anyone interested in discussing the turtle module? In-Reply-To: <4DE557FE.7000801@aim.com> References: <4DE557FE.7000801@aim.com> Message-ID: I had tried that, but I was concerned that it returned a None, so I thought there was no way to refer to the screen after using it. Trying it again, it seems: import turtle turtle.setup(800, 600) wn = turtle.Screen() alex = turtle.Turtle() alex.forward(200) wn.exitonclick() works just fine. Thanks, Corey! jeff elkner open book project http://openbookproject.net On Tue, May 31, 2011 at 5:05 PM, Corey Richardson wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > On 05/31/2011 04:59 PM, Jeff Elkner wrote: >> Hi All, >> >> I'm working on an introductory CS book using Python with the turtle >> module, but I'm finding the inability of turtle.Screen() to take >> screen size arguments to be a real pain. ?The screen size appears to >> depend on the screen size of the host environment, which means >> standardizing screen shots for the book becomes impossible. >> >> Any thoughts on this issue? ?It would be a huge help in promoting >> Python's use in education if we could make use of such a potentially >> fine module as the turtle module, but I'm finding it very difficult to >> write curriculum materials that use it since students don't have >> control over the turtle's screen in any easy to use way. >> >> Thanks! >> > > I believe you want turtle.setup, > http://docs.python.org/library/turtle.html#turtle.setup > > - -- > Corey Richardson > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v2.0.17 (GNU/Linux) > > iQEcBAEBAgAGBQJN5Vf+AAoJEAFAbo/KNFvp6KwH/1MPtZirFpQuUKJvNFIFl7y1 > /8b6txcu23RnGSdwcOwL/lhsLqgA5moNotPEn67ifYSTXKJuxsLvCqbmpin0q4Yi > ea9Zw3yNwDb5DCm9jofVZHbSE7h/4v2a6aIUzg4RrMzTiie2KmNuoTpKNYYSu+Wo > 2HxXqJQBFV1d8UJE4tTbQ/1jUOjAi3IZgq7F79Z1lyFwuuvD+0pPwInFnn0iZqo4 > Gl68ndOuB96ZnEtgCtaSdbaP3oPXHWHis/JI2AgtULHkni0ZJXId/DCRtX0S+k7z > FyMLw7HTPe1GIxOuOW2/ObWMDP1AvMFzbdIES5SVaeHyBFC3/tg4tGEskoP1Ym4= > =QBCe > -----END PGP SIGNATURE----- >