Stopped by to hand off some open source to my certified faculty supervisor at the PPS/PDX facility I'll be haunting, starting soon. He'd requested a GIS spin to the Python, which was fortuitous, given I'd done a gig for good geofolk at the DoubleTree earlier this year (just back from Pycon in DC).[1]
What I handed him was: (a) an HTMLParser subclass that screen scrapes some public info about latitudes and longitudes of major US and Canadian cities [2] (b) the large data structure developed therefrom [3] (c) functions to compute rough distance in miles between any two cities in the cities dictionary (many alternatives viable) (d) a function to recast the cities dictionary as some vaguely specified XML (no schema), suitable for writing to a 'stream buffer' of some kind (that's more coffee talk than snake charming, but we aim to be inclusive). The kickoff presentation includes Google Earth, zooming in on our school, figuring out how many bus lengths = one second of longitude at our latitude (roughly). Then we mentally overlay this fabric of hosts and node-clients, all spidery, and shooting packets around (the Internet). Python fits into this ecosystem as a controller, in between models and views in MCV (e.g. between backend SQL engines and front end XHTML). I might screen 'Warriors of the Net' (popular with Hillsboro police and our Saturday Academy students) -- though not necessarily on this first day. Now with 8th graders, it's not my intention that they take all this in all in one go. We'll start with the cities data structure, because that's a rich pool of Python semantics: tuples in a list in a dictionary, with strings and integers both (no floats in this one). Then we'll move to functions, skirting the spherical trig. Then, finally, we'll move to classes and objects, but having already encountered dot notation right from the top: when working with collections, primitive objects. Per my Pythonic Mathematics presentation in Sweden: do a first pass over classes/objects in connection with dot notation, do a second pass later, when students are ready to define their own classes. Metaclasses come later (not in 8th grade). It wouldn't be my goal to have kids writing screen scrapers of the kind we'll be eye-balling, to receive credit (extra credit sure). It's more just the idea of overriding methods, to customize a behavior in response to various tags going by. The concept is easy enough to explain. The nuts and bolts of the process can wait until another day (Feynman's approach in New Zealand: here's everything you need to know, minus what you need to know to actually do it). So we look at code, listen to an explanation of its purpose, but don't have to start with a blank slate and pull an HTMLParser out of a hat. That's not the 8th grade objective. We just want basic fluency around verbs like "to parse" and "to subclass" -- nothing more. The functions they actually *do* write will be simpler: numeric sequences for the most part, and simple substitution ciphers on strings (a grasp of the principles behind RSA by grade 12 is an objective of longstanding in my program; I made significant headway with relevant pedagogical techniques in field testing for Saturday Academy @ OGI).[4] A thread (started long before me) running through all of this is that, in the old days, you could get away with just talking about a language in terms of computer internals, e.g. memory (stack, heap), registers, puts and gets to/from peripherals (including memory mapped video, polling the keyboard). So what's changed? Now a computer has all these ports addressed by an IP number, a name in DNS. We have to explain about TCP/IP, not just about machine languages on chips. In fact, in my training (courtesy 4D Solutions), that's where we start: computer as Internet host. The stuff about Intel inside (or AMD, or Motorola or...) gets more attention later. Kirby [1] http://mybizmo.blogspot.com/2005/03/python-for-gis-experts.html [2] blog entry re using HTMLParser for a different/related purpose: http://worldgame.blogspot.com/2005/11/acting-locally.html [3] http://mail.python.org/pipermail/edu-sig/2005-October/005500.html [4] http://worldgame.blogspot.com/2005/10/saturday-academy.html _______________________________________________ Edu-sig mailing list [email protected] http://mail.python.org/mailman/listinfo/edu-sig
