FYI, here's me replying to myself on the Math Forum. Feedback welcome. A lot of this will go over the heads of my target audience, especially advantage (c), which is all about avoiding unwanted intellectual purity when it comes to enforcing a "one data structure" regime. That's just not Python's paradigm, and that's OK.
http://mathforum.org/kb/message.jspa?messageID=4623827&tstart=0#reply-tree Kirby ==== For those few who don't know, maybe just joined this list, Pythonic Mathematics involves a hands-on, shop-like approach, per Popular Mechanics or more recently Make: (O'Reilly) i.e. using some computer language as an apparatus to build actual "math objects" such as polynomials and rational numbers, polyhedra, vectors, integers with a modulus, quaternions, whatever. The advantages of Python are several, but among the top few would be: a. an interactive evaluation loop b. a strong OO paradigm, and c. simple but not too simple syntax. Let me say a few words about each of these features... <topic = "Python's positive features"> a. An interactive evaluation loop Many languages come with an implied development cycle that includes the step of compilation, perhaps to be followed by a separate linking step, whereby "source code" is translated to a faster, stripped-down machine or assembly language (not to be confused with .NET assemblies). The compiled and linked executables are then usually platform specific, fast, and efficient. The Python engine itself is just such an executable (different binaries work on different operating systems). However, Python source, like Java source, compiles to a byte code language implemented atop a VM (a virtual machine). Transporting Python across platforms means reimplementing the VM in various brands of C (or whatever), while keeping the language itself essentially unchanged at the top level. Yes, some subtle differences in core Python may be felt (perhaps in the frequency of garbage collection), plus the shared libraries will only partially overlap (the GUI widgets on your Nokia cell phone won't match the GUI widgets in Gnome), but still, the high level of cross-platform compatibility means we can't be accused of fostering servile obedience to any one particular operating system and/or business model and/or corporate regime. As users jump from one computer to another, perhaps between operating systems, the Pythonic VM presents a fairly constant command line environment to the student, maintaining continuity and allowing the swift learning cycle associated with "immediate feedback" i.e., in being interpreted to byte codes, Python is able to accomplish line-at-a-time translation to executable code, meaning the student has full access to an interactive command line experience, as well as a scripting mode. Note: Python is one of many languages to host its own interactive shell sessions, some others being Logo, Scheme, APL, J, ISETL, and xBase (the various dBases and FoxPros). b. A strong OO paradigm Many teachers don't seem to realize that OO is valuable for its connections to everyday experience, in terms of shared metaphors, not because it's the superior paradigm for all programming or anything like that. OOP is simply very accessible to neophytes, provides a bridge, in the form of a simple yet sophisticated set of concepts, easy enough to grasp: blueprints (templates), a class hierarchy, objects as instances, ready for business, presenting methods and properties to their users. Just like in real life: the bus door opens, passengers get on, paying or flashing passes -- now draw that in OO. Python is very consistent in its OOness. Primitive objects like 1, 2e-5, 'b', 3j are immutable objects, with callable methods. 1 + 1 is equivalent to 1 .__add__(1), i.e. we're passing the right-of-operator argument to the polymorphously definable __add__ method, in this case the version associated with the integer class or type. The __add__ method characteristic of vector objects, as in vA.__add__(vb), as in vA + vB, would be somewhat different, but with commonalities (e.g. per the group theoretic properties of 'addition' (the existence of an additive identity, inverse and so on)). Through the lense of an OO language, the apparatus of ordinary K-12 level mathematics becomes surveyable as an extensible type system, not just in practical terms, but somewhat formally and theoretically as well (yet just the practical advantages alone would be enough to motivate the change-over, at least out here, in our Silicon Forest economy). c. Simple but not too simple syntax The "batteries included" aspect of Python is in part its Standard Library, but more primitively its rich set of built-in data structures. It shares this feature with other so-called P languages (Perl and PHP -- remember LAMP?), with Ruby, with myriad others. There's less of a compulsion to regard data structures as atomic, such that one lucky devil must be ultimately cast as the root form of all other data structures. Yes, there's satisfying intellectual purity in pursuing the "holy grail" of data structures, but other pursuits deserve their own shining knights. Python's quest is not to turn everything into lists, but everything into objects. That's the atom (the object). Our goal has already been attained. We're entitled to preach our little OO gospel without too much guff from the functionalists or whomever. A richness of built-in data types is not an embarrassment, but simply an intelligent-enough design, a workable set of primitive tools. We have the punctuation on every ASCII-compatible keyboard ({}, (), []) so why not use what we've got? Dictionaries, tuples and lists, oh my. </topic> However, much of what I intend to talk about in London won't be all that language-specific. You won't have to know Python to understand my proposal: that we phase out such heavy reliance on calculators and give students more opportunities to tune in what the computer scientists have been up to in these last few decades. It could no kidding even help with their math skills and boost their level of understanding. In any case, it's worth trying, and trials are currently underway, with more planned. Kirby _______________________________________________ Edu-sig mailing list [email protected] http://mail.python.org/mailman/listinfo/edu-sig
