From Arthur_Siegel@rsmi.com Thu Mar 1 01:39:40 2001 From: Arthur_Siegel@rsmi.com (Arthur_Siegel@rsmi.com) Date: Wed, 28 Feb 2001 19:39:40 -0600 Subject: [Edu-sig] Switching gears.. Message-ID: <0051623C.N22121@rsmi.com> Kirby wrote - >I think I'll give up pursuing the "math through programming" >thread with the math teachers. I'll stay in contact with >the few with an interest who got in touch, but most of the >time it's like talking to a brick wall. If any consolation, you're doing well at least when preaching to the converted. The concept in "Overcome" of looking at code as an alternative form of math notation - with the added feature that it not only says what it means, but does what it says it means - certainly sells me. It is interesting that our agendas do diverge - I think you consider yourself an innovator looking to revamp math education from the ground-up with new fundamental concepts, and I consider myself in many ways a reactionary, looking to restore something that I believe once was, and got lost . And yet we agree on so much. Not that that fact gets either of our agendas anywhere. ART From delza@antarcti.ca Thu Mar 1 04:43:09 2001 From: delza@antarcti.ca (Dethe Elza) Date: Wed, 28 Feb 2001 20:43:09 -0800 Subject: [Edu-sig] Re: Switching Gears (long) Message-ID: <003601c0a20a$1d9a5480$60294c18@vf.shawcable.net> Re: Teachers I grew up travelling a lot, changing schools, always being the outsider. I got to compare a lot of school systems (including private, public, priviledged suburban, inner city, Catholic, and alternative) and a lot of teachers. I had a fair number of really excellent teachers over the years. One math teacher who taught me a lot more than math, for instance. I also had teachers who varied from incompetent to apathetic to downright hostile (one gym teacher who tried to get in physical confrontations with the kids, and I'm talking 4th-5th graders). A good teacher can make a big difference. Unfortunately, the system is flawed on so many levels. Even with great teachers, school was very traumatic. By changing schools so often I was always the outsider, which may have been part of it. Part of was that I didn't clique well. Part of it was the essential meaningless of what we were forced to do. Here's an example of how bad it got: One day I woke up with a spontaeous nosebleed and my mom let me stay home from school. For the next couple of weeks I spent part of the morning punching myself in the nose to try (unsuccessfully) to recreate it. But I survived the system (the alternative schools helped) and even went on to finish a bachelor's degree and a master's. Now I have two kids, a girl (Mina) age 4, and a boy (Azlen) age 6 months. My wife (Daniela) and I have discussed what to do if they don't like school--we won't force them to go. So far it's not a problem. Mina is in daycare and Montessori, and loves it. She is very social and needs to be around other kids, and to have lots of structured learning time (like most kids if allowed, she soaks up learning like a sponge). She starts kindergarten in the fall, and we've found a very nice K-3 primary school. There are only 100 kids, and the principal, who showed us around, seemed to know them all by name. So Mina will be going to school. But I still consider her homeschooled. Daniela spent three years home with Mina and it shows--she can read more than 30 words, write her name, and do simple math in her head (as long as it involves Fig Newtons). She's going to school for social skills -- like surviving bad teachers. We'll try to cushion the blow of the real world, but we have to expose her to it eventually. If she absolutely hates school, she can stay home and get a better education and we'll find other paths for socializing, but I don't think that will happen. She's got a very different personality than me, very extroverted, so to her school will just be a bigger audience for her, and she'll probably continue to do additional "academic" learning at home. After all, she has two over-educated parents. What I'm trying to say, is that the schools can't and won't be the solution. School, especially in the US, is designed to keep kids off the streets as long as possible, train them to sit stil and endure boredom for hours at a time to prepare them for the work force, and to follow meaningless instructions without question or creativity. And, on the scale of education institutions in the US, that's how they *have* to be. The criticisms that are levelled against the schools/teachers/curriculum are the same now as they were 100 years ago. Literally. In that time there have been any number of suggestions for improving the situation, any number of attempts to change. Some really great ideas. But the system has proven to be very resillient to significant change. The best hope for schools is small, localized change -- that can work and is working in many places. But trying to change the way math is taught, in toto, is tilting at a very big windmill. There have always been some great teachers, who rise above the system. Even great (usually very small) schools. And there will continue to be good reasons for kids to go to school. The three Rs just might not be among them. --Dethe From pdx4d@teleport.com Thu Mar 1 04:56:20 2001 From: pdx4d@teleport.com (Kirby Urner) Date: Wed, 28 Feb 2001 20:56:20 -0800 Subject: [Edu-sig] Switching gears... In-Reply-To: <3A9D5F2A.D28B467A@lipn.univ-paris13.fr> References: <8010912471E0D41189930090278D4E480FF021@SPAWN> Message-ID: <3.0.3.32.20010228205620.009379e0@pop3.norton.antivirus> It's rather complicated in the US. The National Council of Teachers of Mathematics publishes standards which private text book companies advertise they follow. Then you have some states like California which have published their own standards, and lots of raging debates, so-called "math wars" over what is an appropriate approach. So questions like yours tend to prompt a lot of opinions about various text books, which one is the best or worst, each with its champions. Not so long ago, I did a web search on "fuzzy math" (one of the criticisms of the so- called "new new math" is that it's "fuzzy") and collected some example links. You can find them here: http://www.mathforum.com/epigone/math-teach/quaxswinfrou If you really want to know more, I can send you some more URLs. In any case, it's not a simple picture. Kirby PS: none of the K-12 text books do anything with Python that I'm aware of. I think teachers should be responsible for developing curriculum and sharing it over the web within their professional peer group (many teachers are doing this already). The mass publishing approach has too much inertia, is too slow to adapt. A few schools with a future-oriented mindset are using the web to compensate for the short-comings of these obsolete text book offerings. Most are stuck in a rut, which is sad for the students. At 09:27 PM 02/28/2001 +0100, Emmanuel Viennet wrote: > > Hi, > >I follow with interest your discussion about math >teaching in the US. The situation in France may >be similar... >Just for my curiosity, where can we get on the web >the details of the math program for the K12 >curriculum ? > >Thanks >Emmanuel From Arthur_Siegel@rsmi.com Thu Mar 1 17:21:50 2001 From: Arthur_Siegel@rsmi.com (Arthur_Siegel@rsmi.com) Date: Thu, 1 Mar 2001 11:21:50 -0600 Subject: [Edu-sig] In praise of VPython Message-ID: <005197DF.N22121@rsmi.com> Having instigated some unpleasantness on the list, I feel some special obligation, perhaps, to try to be as loud about what I see as positive developments as I have been about what I see as negative. To those who might see it as OT, my apologies. VPython is exciting. The more I understand its design, intentions, and implementation the more appreciative I become. Jason Cunliffe had tried to give me a clue that I was missing something. I had been guilty of selling it short as another Python scripting add-on to a graphic C/C++ app/renderer. In fact it is what its original name implied it was going to be - visual Python. Designed out of of the box by folks with a deep understanding and appreciation of Python and Numeric. Having gotten used to working with Python add-on scripting and having to write contorted Python to get the results I was looking to achieve , it took me a while to catch on to the fact that all VPython needs and wants is good, concise Python - no backbends necessary. For example, the complete "from scratch" construction of a beautfully rendered sphere from a VPython demo (there is a sphere primitive, the following actually being the pedagogical long way around in VPython) from visual import * L = [ ] for t in arange(0,2*pi,0.2): for s in arange(0,pi,0.1): L.append((cos(t)*sin(s), sin(t)*sin(s), cos(s))) convex(pos=L, color=(0.5,0,0.5)) Concise mathemathical notation for an analytical sphere, and at the same time the sphere itself - again,, beautifully rendered. >From my take, much of what I had hoped to see achieved in concrete form in connection with edu-sig comes together with the existence VPython. Hope those out in the field - teachers designing Python based curriculum - begin to take advantage of what it has to offer. ART From pdx4d@teleport.com Thu Mar 1 17:00:43 2001 From: pdx4d@teleport.com (Kirby Urner) Date: Thu, 01 Mar 2001 09:00:43 -0800 Subject: [Edu-sig] Re: Switching Gears (likewise long) In-Reply-To: <003601c0a20a$1d9a5480$60294c18@vf.shawcable.net> Message-ID: <3.0.3.32.20010301090043.00b22520@pop3.norton.antivirus> I enjoyed reading about your experiences Dethe. My trajectory was through K-2 in Portland, Oregon (where I live today), 3rd at Junior English School, Rome (had to wear a tie), 4-8th Overseas School of Rome (loved it), 9 (1st half) at Southeast High, Bradenton Florida (not much fun), 9 (2nd half)-12 International School, Manila, Philippines (fun after an adjustment period). My first job after college was as a high school math teacher -- 2 years (1981-82) at St. Dominic Academy (all girlz) in Jersey City, New Jersey (geometry - calculus + world history and a team teacher of an honors humanities 2nd yr). This was around the time I started getting into Bucky Fuller and his influence over my math content started to show around then. In college, I really got into computers, and the first language I learned was APL. APL was my first love (in the computer languages department). In a lot of ways, Python takes me back to those APL days. I learned Fortran and PL/1 later, some Assembler, SNOBOL, other stuff, and in the 80s/90s did Xbase for pay, mostly for non-profit social service agencies (including in Bhutan as a volunteer), later the cardiac operating theater -- I still have Xbase work on my plate to this day. I was a philosophy major though, not a computer science or engineering student. My focus was Ludwig Wittgenstein's stuff, under the tutelage of Richard Rorty (a big name in philo) and Vic Preller (not as well known, but a creative genius -- just died recently). Python takes me back to my APL days, as Python's primitives tend to build these powerful little expressions in the way APL's did (with the concommitant danger that one maybe gets too cryptic, tries to pack too much in a single line). My thought at Princeton when playing with APL was "gee, this would have been a lot of fun in high school", and that's my same thought with Python: a lot of kids would really groove on this stuff, if only given an opportunity. My daughter is now six and went to a Montesorri pre school, where one of her teachers is also a family friend, was present at her birth. Now she's in a public school, but it's a rather different kind of school, called a family coop. The parents are expected to participate in the life of the school to the tune of 100 hours per year, which may involve spending time in classrooms and even teaching content. Coincidentally, today is my first opportunity to teach just such a "mini-course". I have two 45 minute periods (shorter than usual because they get some recess before gym), today and tomorrow, with half my daughter's class, while the other half goes to the library to learn some research skills. I'll get the other twelve (including my daughter) down the road. We're going to do polyhedra 'n stuff (a little sphere packing). Like most curricula, this school's features the cone, cylinder, cube, rectangular and triangular prisms, sphere and three-side pyramid. They've dropped any emphasis on classical topics like the Platonic 5, or the Archimedian 13. Plus there's no exposure to the more modern (1700s) generalization, captured by Euler in the equation V + F = E + 2 (vertices + faces = edges + 2). Based on experience with young kids in other classrooms (including in Bhutan and Lesotho), I know the above content will fly, plus I have geometry video and overhead transparencies, to supplement hands-on models. We'll also be treating polyhedra as measuring cups and pouring pumpkin seeds from one to the other. Mine are scaled such that the tetrahedron will serve as the basic measuring cup and they'll pour into other shapes to get whole number results: cube = 3, octahedron = 4, rhombic dodecahedron = 6, cuboctahedron = 20 -- except I'm not sure I have quite enough pumpkin sees to fill the cuboctahedron (there's still time to go to the store, maybe get another dried good altogether). Given you've studied 'Synergetics' some, you know where all this comes from. That Fuller's pedagogical innovations haven't been phased into K-16 at most levels (even though this content was popular with kids when he taught it, and many creative students thrived under his tutelage) is of course one of my main beefs with academia. This continued, willful ignorance on the part of academics about one of the 20th century's createst minds is just unconscionable. If this were high school, and I were in charge, we'd spend time looking at the polyhedra as objects in an OO framework, using Python to code up the Polyhedron class, and then subclassing the others from this superclass (I've gone through this exercise using Xbase, Java, and Python, with the results chronicled at my website). The rotation, translation and scaling methods would be defined at the superclass level, so that all subclasses could inherit it. That's a great intro to OO, matrices (or quaternions depending on how we choose to implement rotation), which builds on geometry they've known since first grade (given this is my own fantasy-world curriculum). I'd also be using Python for number theory and other math-related stuff before the end of high school. I just think (Guido's?) implementation of Euclid's Algorithm for finding the greatest common divisor of two numbers is the bee's knees: def gcd(n,m): """Euclid's Algorithm""" while m: n,m = m,n%m return n >From this, you can use list comprehension to get a list of relative primes < n: def relprimes(n): """Coprimes of n < n""" return [x for x in range(1,n) if gcd(n,x)==1] And the number of such primes is what's returned by Euler's totient function: def totient(n): """Number of coprimes < n""" return len(relprimes(n)) Although, if you know the prime factors of n, there's a faster way to compute the totient: def totient(n): """Totient if prime factors known""" factors = unique(primes.getfactors(n)) result = n for f in factors: result *= (1 - 1.0/f) return result Which leads to another of Euler's famous generalizations, and Fermat's special case Little Theorem, a special case of Euler's: Euler: If gcd(m,n)=1, then m^totient(n) mod n = 1 Fermat: If gcd(a,p)=1, p is prime, then a^(p-1) mod p = 1. Testing in Python: >>> totient(561) 320 >>> gcd(561,2) 1 >>> pow(2,320,561) # = (2**230)%561 1 I agree with you that the curriculum has a lot of antibodies protecting it from major change. But major changes have and do occur. We had 'new math' and now 'new new math' etc. Kids don't have to learn Latin or ancient Greek any more (although I'll be teaching some greek roots -- tetra, hexa, octa, icosa -- this morning). For better or for worse, reforms do sweep through the curriculum, always in response to various pressures. What gives me a lot of leverage today is the internet, which is able to reach students independently of the bureaucracies and text book fiefdoms. I can do more than just wring my hands over the sorry state of the curriculum -- I can source curriculum and share it with a global readership (I get emails from all over, and that's great). Another source of hope is television. Math education on TV is conventionally of really poor quality, but it doesn't have to be that way. The cultural influences at work here are much bigger than just what goes on in in the math ed community. I think we can realistically expect TV programming that sparks a feedback loop which helps to galvanize the change process. Lastly, I'm happy that the math curriculum overlaps the computer science curriculum to such a large extent, as this means the incursion of programming into K-12 provides more opportunities to address some of the failings and weaknesses in math class, where calculators rule. With kids down the hall using real computers, and doing far more interesting math-related projects with a VHLL like Python, it'll be harder and harder for math teachers to justify their head-in-the-sand attitude towards "math through programming", and their luddite fixation on graphing calculators as the be-all/end-all technology when it comes to teaching algorithms. Kirby From pdx4d@teleport.com Thu Mar 1 22:14:22 2001 From: pdx4d@teleport.com (Kirby Urner) Date: Thu, 01 Mar 2001 14:14:22 -0800 Subject: [Edu-sig] Switching gears.. In-Reply-To: <0051623C.N22121@rsmi.com> Message-ID: <3.0.3.32.20010301141422.00a243c0@pop3.norton.antivirus> >It is interesting that our agendas do diverge - I think you consider >yourself an innovator looking to revamp math education from >the ground-up with new fundamental concepts, and I consider myself in >many ways a reactionary, looking to restore something >that I believe once was, and got lost . And yet we agree on so much. I'm not sure to what extent our thinking diverges outside some set of concepts related to geometry. At this point, I don't have an overview of how you'd approach inter- connecting math topics outside of Euclid's Elements and projective geometry (neither of which I have any problem including, which isn't to say I've achieved the level of mastery you have vis-a-vis either). In some ways, I'm trying to recover classical topics that used to be covered as a matter of course. Today with the 1st graders it was all about greek roots (tetra, octa... hedron) and chatter about the Platonic Five -- what sets them apart from the others etc. The only non-classical part was the bean-fill (using lima beans and polyhedra as measuring cups) -- although that could be considered Pythagorean, as I hear the school was really into beans somehow. Kirby PS: my overview.html (vs. overcome.html) is at: http://www.inetarena.com/~pdx4d/ocn/overview.html >Not that that fact gets either of our agendas anywhere. > >ART From pdx4d@teleport.com Fri Mar 2 16:34:05 2001 From: pdx4d@teleport.com (Kirby Urner) Date: Fri, 02 Mar 2001 08:34:05 -0800 Subject: [Edu-sig] In praise of VPython In-Reply-To: <005197DF.N22121@rsmi.com> Message-ID: <3.0.3.32.20010302083405.009453d0@pop3.norton.antivirus> >Hope those out in the field - teachers designing Python based curriculum - >begin to take advantage of what it has to offer. > >ART I have both 2.0 and 2.1a2 on my G: drive. VPython insists on putting all its files on C:, maybe because 2.1 has the last word in some registry entry -- probably why I can't get Python 2.0's IDLE to boot, even though I can boot the ActivePython Pythonwin interface. Once I move all the VPython stuff to G:\Python20, by zipping down and unzipping in the correct directory, I still can't get its version of IDLE to boot (again, likely for registry reasons -- 2.1 has to be my final install). A question about VPython -- can I use it independently of its version of IDLE? Like in Pythonwin or the indigenous IDLE? How about from ye old MSDOS box? Anyway, it looks to me like the Windows registry structure and/or Python Windows install process is too awkward to permit Python 2.0 and Python 2.1 to co-exist peacefully enough for add-ons like VPython to work. So I either blow away the 2.1a2 or sit tight and wait for the add-ons to migrate up the development curve. Or...? Maybe someone out there as both Pythons and VPython all working on the same Wintel box? Kirby From fred@ontosys.com Fri Mar 2 17:31:18 2001 From: fred@ontosys.com (Fred Yankowski) Date: Fri, 2 Mar 2001 11:31:18 -0600 Subject: [Edu-sig] In praise of VPython In-Reply-To: <3.0.3.32.20010302083405.009453d0@pop3.norton.antivirus>; from pdx4d@teleport.com on Fri, Mar 02, 2001 at 08:34:05AM -0800 References: <005197DF.N22121@rsmi.com> <3.0.3.32.20010302083405.009453d0@pop3.norton.antivirus> Message-ID: <20010302113117.A67194@enteract.com> VPython works fine from a command shell. I edit my programs in Emacs and run them directly from a Cygwin shell on NT. The "Kinetics Kit", http://stud4.tuwien.ac.at/~e9326522/KineticsKit/, provides some compelling examples of VPython's power. On Fri, Mar 02, 2001 at 08:34:05AM -0800, Kirby Urner wrote: > A question about VPython -- can I use it independently of its version > of IDLE? Like in Pythonwin or the indigenous IDLE? How about from > ye old MSDOS box? -- Fred Yankowski fred@OntoSys.com tel: +1.630.879.1312 Principal Consultant www.OntoSys.com fax: +1.630.879.1370 OntoSys, Inc 38W242 Deerpath Rd, Batavia, IL 60510, USA From dscherer@vysics.com Fri Mar 2 17:51:58 2001 From: dscherer@vysics.com (David Scherer) Date: Fri, 2 Mar 2001 12:51:58 -0500 Subject: [Edu-sig] In praise of VPython In-Reply-To: <3.0.3.32.20010302083405.009453d0@pop3.norton.antivirus> Message-ID: > I have both 2.0 and 2.1a2 on my G: drive. VPython insists on putting > all its files on C:, maybe because 2.1 has the last word in some > registry entry -- probably why I can't get Python 2.0's IDLE to boot, > even though I can boot the ActivePython Pythonwin interface. Maybe Tcl/Tk isn't working? > Once I move all the VPython stuff to G:\Python20, by zipping down and > unzipping in the correct directory, I still can't get its version > of IDLE to boot (again, likely for registry reasons -- 2.1 has to > be my final install). If the ordinary Python 2.0 IDLE isn't working, it's not too surprising that the VPython version doesn't work either. You should try running it from a command prompt and post the error messages to visualpython-users or idle-dev. > A question about VPython -- can I use it independently of its version > of IDLE? Like in Pythonwin or the indigenous IDLE? How about from > ye old MSDOS box? It will work fine with command-line Python. Most existing Python IDEs except for the VPython IDLE execute the user program in their own process, which makes VPython programming more difficult (though it remains possible if you are very careful). For example, the preferred way to do simple animations in VPython is something like: from visual import * ball = sphere() while 1: rate(100) ball.x = ball.x + 0.01 This sort of infinite loop will give some IDEs problems in and of itself. Worse, visual will attempt to terminate the program forcefully when you close the graphics window, which will terminate your IDE! The workaround is: from visual import * scene.exit = 0 # disable automatic exit behavior ball = sphere() while scene.visible: rate(100) ball.x = ball.x + 0.01 which isn't so bad. But if you screw up you will terminate your IDE and perhaps lose work. > Anyway, it looks to me like the Windows registry structure and/or > Python Windows install process is too awkward to permit Python 2.0 > and Python 2.1 to co-exist peacefully enough for add-ons like VPython > to work. So I either blow away the 2.1a2 or sit tight and wait for > the add-ons to migrate up the development curve. Or...? Maybe > someone out there as both Pythons and VPython all working on the > same Wintel box? The add-ons will migrate up the development curve fastest if people with problems attempt to diagnose them in detail and report them :) Thanks, Dave p.s. Bruce: Can you say exactly what registry keys are used by the installer to locate Python? Do we prompt for an installation path if the correct keys are not found? From urner@alumni.princeton.edu Sat Mar 3 02:07:25 2001 From: urner@alumni.princeton.edu (Kirby Urner) Date: Fri, 02 Mar 2001 18:07:25 -0800 Subject: [Edu-sig] Hitting two targets: OO + group theory (pedagogy) Message-ID: ============== OREGON CURRICULUM NETWORK ===================== RE: HITTING TWO TARGETS: OO + MATH TOPIC OO + POLYHEDRA In earlier writings, I've discussed how object-oriented (OO) syntax might be melded with math notations with regard to polyhedra.[see links] A Polyhedron superclass, subclassed as Tetrahedron, Octahedron etc., would demonstrate the concepts of class hierarchy and instantiated selves, or objects. Many intro-to-OO books use already flatlander shapes (superclass: shape; subclasses: triangle, circle, square...). However the Polyhedron case is mathematically more interesting and takes better advantage of the computer's graphical display capabilities. Rotation, translation and scaling may be implemented using matrices, or we might swap in quaternions to accomplish rotation, or we might develop use some other Clifford Algebra ala Hestenes et al. OO + GROUP THEORY More recently, I've been looking to group theory as another paradigm case for hitting two targets with one stone: OO concepts and number-theoretic math concepts. Each set of concepts helps to reinforce the other, thereby bootstrapping students into a synergetic mindset which sets the stage for elaboration both in programming and in abstract mathematics. Whereas this might at first sound like a college level approach, my contention is that newcomers to programming will leap-frog those who cut their teeth in the hay day of procedural programming -- which doesn't mean the procedural approach has gone out of style, only that it's no longer relevant to consider the object-oriented as "advanced", with mastery of earlier forms a prerequisite. Functional programming methods will also make their debut earlier in a student's career. And group theory has always been accessible at a variety of levels. It makes sense to start phasing in some of these concepts early, so that later plantings of these ideas find fertile ground. PYTHON AS INTRO LANGUAGE The computer language of choice in these explorations is Python. We want a language which is interactive at the command line, like Logo, such that programmed methods may be accessed and combined on the fly, with the screen itself serving as a principal site for i/o. Whereas we'll want the option to read in text files for processing, there should be no demand on students to compile standalone executables which must either support their own GUI for interactivity, or rely on command line arguments pointing to files containing the raw data of interest. ISETL, DrScheme, APL and others share these positive features with Python and there's no stipulation here that only Python is the appropriate vehicle for these kinds of activities (given the OO focus, some of these others do not lend themselves to hitting our double-target) -- only that this author has found the Python environment highly congenial for this kind of undertaking. Let's define our sandbox to be groups of relative primes less than a particular prime modulus n. These are groups under multiplication, where a*b is defined as (a*b) mod n. In Python, the mod operator is %, such that a%b returns the remainder a (mod b). SYNTAX BASICS The primitive built-in function pow() takes a mininum of two arguments a,b such that pow(a,b) = a^b (or a**b in Python, as exponentiation is signified with a double-asterisk). The optional 3rd argument provides a modulus, such that pow(a,b,n) = (a**b) mod n. This 3-argument form of pow() is internally optimized such that the modulus is used to reduce the product as powering proceeds -- far more efficient than applying the syntax (a**b)%n, which can take indefinitely longer to complete for large numbers. Where object-oriented syntax shines in this application is when we go to define multiplication. We're able to override the meaning of * (multiplication operator) in such a way that operator.mul will likewise behave consistently, i.e. will respect the definition we provide for multiplication. This is done be defining __mul__ in the class definition. Similar overriding is done with respect to ** and pow(), by defining __pow__, and for relational operators <, >, and ==, by defining __lt__, __gt__, and __eq__ respectively. I won't go into a full-blown dissection of source code here, but rather will conclude with an interactive command line session which gives the flavor of the final result. In class, or over the web (if a distance learning opportunity), students would be boning up on Python and some of the basics of group theory via supplementary materials. Some of the preliminary prototypical writing is available in draft form on math-learn, an egroup focussed on K-12 math education, with emphasis on the middle school years. [see links below] Further forays into group theory + Python may be found in the 'For further reading' section of my intro page on cryptography. COMMAND LINE INTERFACE (CLI) Here's from the Python command line: >>> from groups import * >>> residues17 = factory(17) # make objects using coprimes of 17 >>> residues17 # display as list of integers [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16] >>> table(residues17) # generate a multiplication table 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 ---------------------------------------------------- 1| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 2| 2 4 6 8 10 12 14 16 1 3 5 7 9 11 13 15 3| 3 6 9 12 15 1 4 7 10 13 16 2 5 8 11 14 4| 4 8 12 16 3 7 11 15 2 6 10 14 1 5 9 13 5| 5 10 15 3 8 13 1 6 11 16 4 9 14 2 7 12 6| 6 12 1 7 13 2 8 14 3 9 15 4 10 16 5 11 7| 7 14 4 11 1 8 15 5 12 2 9 16 6 13 3 10 8| 8 16 7 15 6 14 5 13 4 12 3 11 2 10 1 9 9| 9 1 10 2 11 3 12 4 13 5 14 6 15 7 16 8 10| 10 3 13 6 16 9 2 12 5 15 8 1 11 4 14 7 11| 11 5 16 10 4 15 9 3 14 8 2 13 7 1 12 6 12| 12 7 2 14 9 4 16 11 6 1 13 8 3 15 10 5 13| 13 9 5 1 14 10 6 2 15 11 7 3 16 12 8 4 14| 14 11 8 5 2 16 13 10 7 4 1 15 12 9 6 3 15| 15 13 11 9 7 5 3 1 16 14 12 10 8 6 4 2 16| 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 >>> a = residues17[7] # select a = specific object >>> a 8 >>> a.inv() # compute a's inverse 15 >>> a*a.inv() # a * a^-1 = 1 1 >>> powers(residues17) # compute g to successive powers 1 = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] 2 = [1, 2, 4, 8, 16, 15, 13, 9, 1, 2, 4, 8, 16, 15, 13, 9] 3 = [1, 3, 9, 10, 13, 5, 15, 11, 16, 14, 8, 7, 4, 12, 2, 6] 4 = [1, 4, 16, 13, 1, 4, 16, 13, 1, 4, 16, 13, 1, 4, 16, 13] 5 = [1, 5, 8, 6, 13, 14, 2, 10, 16, 12, 9, 11, 4, 3, 15, 7] 6 = [1, 6, 2, 12, 4, 7, 8, 14, 16, 11, 15, 5, 13, 10, 9, 3] 7 = [1, 7, 15, 3, 4, 11, 9, 12, 16, 10, 2, 14, 13, 6, 8, 5] 8 = [1, 8, 13, 2, 16, 9, 4, 15, 1, 8, 13, 2, 16, 9, 4, 15] 9 = [1, 9, 13, 15, 16, 8, 4, 2, 1, 9, 13, 15, 16, 8, 4, 2] 10 = [1, 10, 15, 14, 4, 6, 9, 5, 16, 7, 2, 3, 13, 11, 8, 12] 11 = [1, 11, 2, 5, 4, 10, 8, 3, 16, 6, 15, 12, 13, 7, 9, 14] 12 = [1, 12, 8, 11, 13, 3, 2, 7, 16, 5, 9, 6, 4, 14, 15, 10] 13 = [1, 13, 16, 4, 1, 13, 16, 4, 1, 13, 16, 4, 1, 13, 16, 4] 14 = [1, 14, 9, 7, 13, 12, 15, 6, 16, 3, 8, 10, 4, 5, 2, 11] 15 = [1, 15, 4, 9, 16, 2, 13, 8, 1, 15, 4, 9, 16, 2, 13, 8] 16 = [1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16] >>> b = residues17[12] # pick a g the period < totient >>> b 13 >>> sg = subgroup(b) # generate the subgroup using b >>> sg [1, 13, 16, 4] >>> table(sg) # generate the multiplication table 1 4 13 16 ---------------- 1| 1 4 13 16 4| 4 16 1 13 13| 13 1 16 4 16| 16 13 4 1 The source code I'm using is here: http://www.inetarena.com/~pdx4d/ocn/python/groups_draft1.html Links: OO + Polyhedron: http://www.inetarena.com/~pdx4d/ocn/oop.html also: http://www.inetarena.com/~pdx4d/ocn/trends2000.html See bottom of http://www.inetarena.com/~pdx4d/ocn/overcome.html for links to the math-learn postings (these were rough drafts -- a better version for the web is in the works) Also see: http://www.inetarena.com/~pdx4d/ocn/clubhouse.html ============== OREGON CURRICULUM NETWORK ===================== By Kirby Urner, 4D Solutions, Portland, Oregon, USA From delza@alliances.org Sun Mar 4 00:10:54 2001 From: delza@alliances.org (Dethe Elza) Date: Sat, 3 Mar 2001 16:10:54 -0800 Subject: [Edu-sig] In praise of VPython References: <3.0.3.32.20010302083405.009453d0@pop3.norton.antivirus> Message-ID: <005101c0a43f$94494aa0$60294c18@vf.shawcable.net> Kirby The PythonWare version of python doesn't muck about with your registry, so it can peacefully co-exist with other versions. http://www.pythonware.com/products/python/index.htm They have installers for 2.0, 1.5.1 and earlier. VPython should be able to play well with it. These installers also include the PythonWare tools like PIL, XML-RPC, etc. Also, VPython no longer requires you to install their version of IDLE (or python). It now plays nicely with others. Have fun playing, I think you'll be hooked. --Dethe ----- Original Message ----- From: "Kirby Urner" To: Cc: Sent: Friday, March 02, 2001 8:34 AM Subject: Re: [Edu-sig] In praise of VPython > > >Hope those out in the field - teachers designing Python based curriculum - > >begin to take advantage of what it has to offer. > > > >ART > > I have both 2.0 and 2.1a2 on my G: drive. VPython insists on putting > all its files on C:, maybe because 2.1 has the last word in some > registry entry -- probably why I can't get Python 2.0's IDLE to boot, > even though I can boot the ActivePython Pythonwin interface. > > Once I move all the VPython stuff to G:\Python20, by zipping down and > unzipping in the correct directory, I still can't get its version > of IDLE to boot (again, likely for registry reasons -- 2.1 has to > be my final install). > > A question about VPython -- can I use it independently of its version > of IDLE? Like in Pythonwin or the indigenous IDLE? How about from > ye old MSDOS box? > > Anyway, it looks to me like the Windows registry structure and/or > Python Windows install process is too awkward to permit Python 2.0 > and Python 2.1 to co-exist peacefully enough for add-ons like VPython > to work. So I either blow away the 2.1a2 or sit tight and wait for > the add-ons to migrate up the development curve. Or...? Maybe > someone out there as both Pythons and VPython all working on the > same Wintel box? > > Kirby > > > _______________________________________________ > Edu-sig mailing list > Edu-sig@python.org > http://mail.python.org/mailman/listinfo/edu-sig > From pdx4d@teleport.com Sun Mar 4 17:19:13 2001 From: pdx4d@teleport.com (Kirby Urner) Date: Sun, 04 Mar 2001 09:19:13 -0800 Subject: [Edu-sig] Hitting two targets: OO + group theory (pedagogy) Message-ID: <3.0.3.32.20010304091913.00b8e480@pop3.norton.antivirus> At 06:07 PM 03/02/2001 -0800, you wrote: > >============== OREGON CURRICULUM NETWORK ===================== > >RE: HITTING TWO TARGETS: OO + MATH TOPIC Note: this had some terminological problems i.e. no such thing as a 'relative prime', only integers 'relatively prime' to others. Plus there's no need to stipulate the modulus be a prime -- in fact one of my examples on math-learn used a modulus of 20. Thanks to David Ullrich on sci.math for these tips, plus urging me to promote Group to a superclass so that we might subclass _specific_ kinds of group, like these groups of coprimes, as subclasses thereof. I have since incorporated these suggestions into my draft code, with an eye to doing another web essay later. Kirby From Arthinator@aol.com Sun Mar 4 22:59:57 2001 From: Arthinator@aol.com (Arthinator@aol.com) Date: Sun, 4 Mar 2001 17:59:57 EST Subject: [Edu-sig] re: Switching gears Message-ID: <17.12680353.27d422ed@aol.com> A previous contribution to the switching gears thread, I find, was returned undelivered: > edu-self@python.org > unknown local-part "edu-self" in domain "python.org" Either my ego showing, or spending too much time this week with Python/VPython. Kirby writes: >I'm not sure to what extent our thinking diverges outside >some set of concepts related to geometry. At this point, >I don't have an overview of how you'd approach inter- >connecting math topics outside of Euclid's Elements and >projective geometry (neither of which I have any problem >including, which isn't to say I've achieved the level of >mastery you have vis-a-vis either). I can promise you I have no level of mastery of over Euclid or anything connected with mathematics. One does not master subjects one comes to at the age of 40 - especially when one is also making a living and raising a family. I am an enthusiastic dabbler. >In some ways, I'm trying to recover classical topics that >used to be covered as a matter of course. Today with the >1st graders it was all about greek roots (tetra, octa... >hedron) and chatter about the Platonic Five -- what sets >them apart from the others etc. The only non-classical >part was the bean-fill (using lima beans and polyhedra as >measuring cups) -- although that could be considered >Pythagorean, as I hear the school was really into beans >somehow. I have lost passion for the argument, but do think it would be ruder not ot respond at all. Kirby, you know as well as I that Book I Prop I before Book I Porp II, and well before Book XI Prop I (where we first see solids) is at the very essence of Euclid. Not making Euclid sacred, but the deductive process does have some "sacredness" IMO. David Joyce's take at: http://aleph0.clarku.edu/~djoyce/java/elements/elements.html closely resembles my own. My own education as an adult started when I was able to suppress my pride, and study the old hat - the older the better. Won't be finding my way back to the current frontiers of human knowledge in this particular life-time. So it goes. But am looking to accelerate the process with whatever tools I can get my hands on. ART From pdx4d@teleport.com Mon Mar 5 19:37:40 2001 From: pdx4d@teleport.com (Kirby Urner) Date: Mon, 05 Mar 2001 11:37:40 -0800 Subject: [Edu-sig] re: Switching gears In-Reply-To: <17.12680353.27d422ed@aol.com> Message-ID: <3.0.3.32.20010305113740.00b0fea0@pop3.norton.antivirus> >I have lost passion for the argument, but do think it would >be ruder not ot respond at all. > >Kirby, you know as well as I that Book I Prop I before >Book I Porp II, and well before Book XI Prop I (where >we first see solids) is at the very essence of Euclid. >Not making Euclid sacred, but the deductive process >does have some "sacredness" IMO. > >David Joyce's take at: > >http://aleph0.clarku.edu/~djoyce/java/elements/elements.html > >closely resembles my own. I'm not sure what the argument is, but maybe it's that we shouldn't be jumping "out of sequence" vis-a-vis Euclid's deductive structure. I'm more a wholes->parts than a parts->wholes kinda guy. Overview is a motivation for learning the nitty gritty details of a system. So I'm not averse to at least naming polys before we get to them in a deductive apparatus, because experience is spatial, not flat, and no infinite planes have ever been disclosed to the senses. Anyway, I don't see having polys in 1st grade as getting in the way of starting with some basic postulates and definitions later -- although in my class it's always emphatic that postulates are not "self evident", but are more in the "cultural convention" or "convenient fiction" category. Given Euclid didn't have access to silicon chips, matrices, Python, POV-Ray, PyOpenGL etc., it makes sense that we'd have a little bit different approach some couple thousand years later. A mix of the old and the new, not straight old, and not straight new, is my preferred blend. Kids born much later in time are confronted with an exponentially greater body of amassed human knowledge/experience. In this day and age, it makes sense to MIRV the trajectories i.e. cover more disparate disciplines within the scope of one topical-thread launch. If you can learn your geometries in conjunction with TV production and/or computer programming, so much the better. Life is short. Kirby From lha2@columbia.edu Mon Mar 5 23:43:45 2001 From: lha2@columbia.edu (Lloyd Hugh Allen) Date: Mon, 05 Mar 2001 18:43:45 -0500 Subject: [Edu-sig] Re: switching gears (and how) References: Message-ID: <3AA424B1.68232459@mail.verizon.net> Arthinator@aol.com wrote: > Kirby writes: > >measuring cups) -- although that could be considered > >Pythagorean, as I hear the school was really into beans > >somehow. Not to make a post completely unrelated to python, but: The Pythagoreans were vegetarian, except that they did /not/ eat beans, being as how when you pop a bean open it resembles a foetus. Now if only I had a footnote for you. ------------------------ Re: Group Thery: One of my colleagues at Ohio State, Jason-whose-last-name-evades-me-right-now, had a neat explanation of group theory in terms of rotating tires--each permutation is an element of the group. To swing it back to Python, could dictionaries and tuples be used to represent groups? Had an image for a second there, but now all of the sudden it's gone. Guess I'll leave the implementation to someone else or another day. From gritsch@iue.tuwien.ac.at Tue Mar 6 09:20:00 2001 From: gritsch@iue.tuwien.ac.at (Markus Gritsch) Date: Tue, 06 Mar 2001 10:20:00 +0100 Subject: [Edu-sig] In praise of VPython References: <005197DF.N22121@rsmi.com> <3.0.3.32.20010302083405.009453d0@pop3.norton.antivirus> <20010302113117.A67194@enteract.com> Message-ID: <3AA4ABC0.7D1B6365@iue.tuwien.ac.at> Fred Yankowski wrote: > VPython works fine from a command shell. I edit my programs in Emacs > and run them directly from a Cygwin shell on NT. I am editing my Python scripts with SciTE (http://www.scintilla.org/SciTE.html), and start them by pressing F5 in this editor. The interpreter is also startet in a separate process. > The "Kinetics Kit", http://stud4.tuwien.ac.at/~e9326522/KineticsKit/, > provides some compelling examples of VPython's power. Thanks for mentioning my little Kit. I added a few screenshots and beautyfied example code. I hope now it's even more easy to understand how to use KineticsKit. Enjoy, Markus From pdx4d@teleport.com Wed Mar 7 08:23:48 2001 From: pdx4d@teleport.com (Kirby Urner) Date: Wed, 07 Mar 2001 00:23:48 -0800 Subject: [Edu-sig] Re: switching gears (and how) In-Reply-To: <3AA424B1.68232459@mail.verizon.net> References: Message-ID: <3.0.3.32.20010307002348.00b7d100@pop3.norton.antivirus> >The Pythagoreans were vegetarian, except that they did /not/ eat beans, >being as how when you pop a bean open it resembles a foetus. I'd never noticed. Kidney beans aren't so interesting I don't think. >To swing it back to Python, could dictionaries and tuples be used to >represent groups? Sure, why not? One common example of a group is a set of permutations, which are number or letter swappers. This can be shown as a dictionary e.g. {'A':'D','B':'E','C','F'...} -- each letter is being swapped with another letter 3 letters further head in the alphabet, a so-called Julius Caeser cipher (hard to believe they'd have thought this secure -- I guess 'Z' wraps around somehow -- to 'C'). You could show it like this: Before: ABCDEFGHIJKLMNOPQRSTUVWXYZ After: DEFGHIJKLMNOPQRSTUVWXYZABC Such dictionaries may be re-expressed using what're called disjoint subcycles: (('A','D','G','J'...),('R','K','L')). The way you read this is to see each letter becoming the next one in the tuple, e.g. 'A'->'D', with the last becoming the first e.g. 'L'->'R'. The above tuples example isn't the same JC cipher exactly -- because I wanted to have more than one subcycle. But anyway it's a permutation. So there you have it: dictionaries and tuples of tuples, with optional Python code to convert back and forth between these two ways of giving the same info. The group aspect comes in with this operation symbolized with *, and which defines how two permutations related by this operator result in.... you guessed it, another permutation (groups are 'closed', meaning you always get a whatever-it-is when you operate on two whatevers-they-are). Because group elements may include so many kinds of data (permutations are just one kind go group element among any number), and because * means different things in different groups, it makes sense to use these data structures provided by Python AND the object-oriented syntax, since with OO we get the ability to override * by redefining __mul__ however we like. So whereas the _data_ of a group element might be stored in a tuple or dictionary, I like to think of these elements as _also_ containing knowledge of how to * (i.e. how to "multiply" -- whatever that means (depends on the group (there has to be something called an 'identity element' though, such that A*e = e*A = A, and every group element has to have an 'inverse' such that A*A.inv()=e (* also has to be associative, i.e. A*B*C better not be ambiguous, in terms of its answer)))). Mnemonic ======== CAIN: Closure, Associative, Inverse, Neutral (identity) Abel: If * is also commutative (optional), it's an Abelian Group Drawing from the book of Genesis. Good place for a Py.. er snake. Kirby From gritsch@iue.tuwien.ac.at Thu Mar 8 14:45:14 2001 From: gritsch@iue.tuwien.ac.at (Markus Gritsch) Date: Thu, 08 Mar 2001 15:45:14 +0100 Subject: [Edu-sig] In praise of VPython References: <200103081336.OAA08753@d1o901.telia.com> Message-ID: <3AA79AFA.A8BBAF5D@iue.tuwien.ac.at> Will Well wrote: > /*Tried to look at KineticsKit, but clicking the above URL gave message, "its missing and to contact you"(?) > wait your kind words and remain, I am sorry, my mistake - I moved the html-files into its own directory. The correct URL is http://stud4.tuwien.ac.at/~e9326522/KineticsKit/html/ Have fun, Markus From dave@se.linux.org Sun Mar 11 11:49:30 2001 From: dave@se.linux.org (David Pettersson) Date: Sun, 11 Mar 2001 12:49:30 +0100 Subject: [Edu-sig] Teaching Python instead of Java? Message-ID: <20010311124930.E859@se.linux.org> Hi, I work as a teaching assistant at my local university, and we currently teach Java only to our new students (Pascal was left a couple of years ago). Although Java is a nice language, I still feel that it is inappropriate to teach new students (some of which have had no prior computer experience!). I have been using Python for a couple of years now, but it was far from my first language (although one could say it is my primary language now :). What I am wondering is if Python is a better alternative, and why if is so. Sincerely, -- David Pettersson Stardate [-30]6312.44 dave@se.linux.org Public key available on request From jeff@elkner.net Sun Mar 11 22:26:42 2001 From: jeff@elkner.net (Jeffrey Elkner) Date: 11 Mar 2001 17:26:42 -0500 Subject: [Edu-sig] Teaching Python instead of Java? Message-ID: Hi David! Thanks for your interest in exploring Python as an introductory programming language! I am a high school teacher who has been using Python to teach our intro course for two years now. I have never seen a better language for that purpose. The main aim when teaching students to program is to give them an understanding of the processes of thought and the underlying concepts used in getting a machine to follow their will. This is a daunting task, and no programming language could make teaching students to think logically easy. The best programming language in the world for teaching programming would be one that does not add any additional overhead to the problem of teaching students to understand variables, conditional branches, and loops. As a Python programmer yourself I'm sure you will understand when I say that Python does that better than any other language I know of. To be concrete about this, let's compare Python with Java. I agree with you that Java is a fine language (and it is definite improvement over C++ for beginners), but it can't compare with Python as a first language. Visit: http://www.ibiblio.org/obp and compare the Java version of "How to think like a computer scientist" with the Python version in terms of length of the code examples. Here is hello world from the Java version: class Hello { // main: generate some simple output public static void main (String[] args) { System.out.println ("Hello, world."); } } Here is the Python version: print "Hello, world." The important thing here is that Java syntax places a great deal of extra requirements on the learner before they can even begin to program. This "syntactic noise" gets in the way of focusing on the problem at hand and makes it more difficult to teach programming concepts. It also raises the bar of entry into learning programming and limits those who can be successful at it. Python is good as a teaching language for the very same reasons that you are now using it to program, it permits you to focus on the problem at hand and doesn't get in your way. Finally, Python has another tremendous strength as an introductory programming language. It supports a large variety of programming styles very well. It is equally at home with proceedural programming and OOP. This is very important for an introductory language. One of the most interesting talks at the Python conference that I just attended was Eric Raymond's discussion of how he used Python to create a new configuration language for the Linux kernel. This was a problem that he described as best being solved with a language like Prolog, and he was able to do it with Python. Thanks again for your inquiry, and let me know if I can be of any further assistance to you. jeff elkner yorktown high school arlington, va On 11 Mar 2001 12:49:30 +0100, David Pettersson wrote: > Hi, > > I work as a teaching assistant at my local university, and we currently > teach Java only to our new students (Pascal was left a couple of years ago). > > Although Java is a nice language, I still feel that it is inappropriate to > teach new students (some of which have had no prior computer experience!). > > I have been using Python for a couple of years now, but it was far from my > first language (although one could say it is my primary language now :). > What I am wondering is if Python is a better alternative, and why if is so. > > Sincerely, > -- > David Pettersson Stardate [-30]6312.44 > dave@se.linux.org Public key available on request From jeff@elkner.net Sun Mar 11 22:36:00 2001 From: jeff@elkner.net (Jeffrey Elkner) Date: 11 Mar 2001 17:36:00 -0500 Subject: [Edu-sig] Online CompSci course Message-ID: Hello again, Walter! On 09 Mar 2001 10:14:49 +0000, Walter G. Ludwick wrote: > OK, Jeff; per your request (appended below), i'll subscribe to the > edu-sig list and migrate this thread over there. I'm a bit reticent about > mixing it up w/ all the Python techs in that forum (i have browsed the > archives enough to know that i'd be out of my depth in most of the > discussion on that list), but i can appreciate the need to widen the > circle of involvement without making a human mail repeater of you :-) Please don't be intimidated by the past traffic on the list. The list was originally set up to discuss projects like yours, and the absense of such discussion is due mostly to the fact that the needed projects didn't exist. You are looking into changing that, so getting things going on the list is important! ;-) > Hey: i just want you to know how much i appreciate your finding time -- > in your hotel room late at nite, i guess -- to pursue this thread with me. > I've just been reading with interest about your activities at this year's > Python conference in the following article by Jeff Shelton (of > "ZopeNewbies" weblog fame): > > >> http://weblogs.userland.com/zopeNewbies/2001/03/08 > > "An instructor and two students from Yorktown High School in Arlington, > Virginia were the next to speak. They have been using Python to teach > programming skills, and are having incredible success. I had met one of > the students, Lex Berezhny, at last year's conference. As luck would have > it, I had the privilege of joining him for lunch twice this week. It's a > real head trip to sit with someone a third your age and realize that he > knows three times more than you about programming. > ... the instructor, Jeffrey Elkner, showed a video produced for the > purpose of convincing high school students they should study Python. Who > should appear in the video but Paul Everitt, Jim Fulton, and Guido van > Rossum!" << > > I think it's really cool that you are promoting the efforts of your > students in this way. > > And i'd love to get a copy of that video. I'm getting some "competing" > advice about building this course in connection with Phillip Greenspun's > "ARS Digita University" (http://aduni.org/), which i suspect might involve > some other language than Python (i.e. TCL/TK, or some other aspect of the > ACS architecture). I am personally less enthusiastic about this > alternative for a variety of reasons (i.e. software licenses that are > somewhat more problematic [software prescribed by this proposed course > must be free], risk of overbearing corporate influence, etc.), but i must > take an open-minded approach at this point. So if there's a way you can > tell me to get a copy of that video, i would greatly appreciate it. > Thanks again, Jeff! The video is far from finished. The good news is that we recieved the funding that we needed at the conference to take it to the next level. That said, I would be glad to send you a copy of what we have so far, but you need to understand that it is still rough at this point. Thanks again for your interest in Python! jeff From Arthur_Siegel@rsmi.com Mon Mar 12 01:34:35 2001 From: Arthur_Siegel@rsmi.com (Arthur_Siegel@rsmi.com) Date: Sun, 11 Mar 2001 19:34:35 -0600 Subject: [Edu-sig] Python raytracing Message-ID: <00565B4D.N22121@rsmi.com> As the subject as come up before, thought there might be some interest in : an opensource raytracer with extensive Python scripting support - a Python/Tk scripting environment at: http://raytressi.free.fr/ Have not had a chance to do much with it, but looks real promising. ART From wgl4@student.open.ac.uk Mon Mar 12 02:48:07 2001 From: wgl4@student.open.ac.uk (Walter G. Ludwick) Date: Mon, 12 Mar 2001 02:48:07 +0000 Subject: [Edu-sig] Online CompSci (py) course Message-ID: I've just subscribed to this list at the suggestion of Jeff Elkner, whose text "How to think like a computer scientist (Python Version)" at http://www.ibiblio.org/obp/thinkCSpy/ quite impressed me -- so much so that i am working on a project proposal to develop a course for delivery in Online Distance Education mode, using this (or something like it) as a central text, and also incorporating groupware for online collaboration among students and tutors. I am a student (second year) in the MA-ODE (Open and Distance Education) program offered by Open University UK through the IET (Institute of Educational Technology); this project should help me to fulfill some of my academic requirements, and perhaps build a bridge to an interesting new career direction (i've been involved with commercial web development for awhile now, am playing with Zope and now looking at Python, but am NO programmer and don't ever expect to be one -- not in this life, anyway! 8-). As part of my "due dilligence," i've a question that i'm hoping this community might help me to answer: Has anyone ever offered a course based on the aforementioned text (or any other derivatives of the original text by Allen Downey), or any course based on the Python language, in Online/ DistanceEd mode? Any references, however obscure, would be most appreciated. Thanks for your attention to this. |/|/alt Walter Ludwick wgl4@student.open.ac.uk From tom-list@home.com Mon Mar 12 04:32:24 2001 From: tom-list@home.com (Tom Malcolmson) Date: Sun, 11 Mar 2001 23:32:24 -0500 Subject: [Edu-sig] Teaching Python instead of Java? In-Reply-To: <20010311124930.E859@se.linux.org> Message-ID: David, I'm not a teacher, but I personally wish that I had learned Python as my first language. I'm glad you asked your question - I've been thinking about this recently. Here are some of the reasons that I think Python is the best language to teach/learn: - Its design is clean, intuitive, and simple. - It is interactive. Being able to play at the command line benefits learning considerably. - It supports multiple programming paradigms: procedural, modular, and object-oriented. Personally, I would want to learn them in that order, but the choice is yours. An aside on this: the OO features of programming languages are essentially 'built on top of' procedural features (which are closer to how the computer really works). Python's advantage is not just that it supports both paradigms, but also that the relationship between the two (the way its OO support is built from its procedural features) is simple, and clear, not hidden as in other languages. This is a great advantage later on when the OO developer is confronted with a stack trace, or a code browser, that presents an OO program in procedural terms. - It provides power without complexity: modules allow the new programmer to do real things without complexity (this is very motivating). My first such tool was MFC - wrong! - The community is helpful & responsive to newbies. The attitude on the comp.lang.python newsgroup is excellent. - It is an alternative to Java. It doesn't make sense to teach everyone the same language in a field that is supposed to be continously changing and innovating. And, unlike Java, the future of python is ultimately controlled by its community, not by the interests of a companies' shareholders. Tom. > -----Original Message----- > From: edu-sig-admin@python.org [mailto:edu-sig-admin@python.org]On > Behalf Of David Pettersson > Sent: March 11, 2001 6:50 AM > To: edu-sig@python.org > Subject: [Edu-sig] Teaching Python instead of Java? > > > Hi, > > I work as a teaching assistant at my local university, and we currently > teach Java only to our new students (Pascal was left a couple of > years ago). > > Although Java is a nice language, I still feel that it is inappropriate to > teach new students (some of which have had no prior computer experience!). > > I have been using Python for a couple of years now, but it was far from my > first language (although one could say it is my primary language now :). > What I am wondering is if Python is a better alternative, and why > if is so. > > Sincerely, > -- > David Pettersson Stardate [-30]6312.44 > dave@se.linux.org Public key available on request > > _______________________________________________ > Edu-sig mailing list > Edu-sig@python.org > http://mail.python.org/mailman/listinfo/edu-sig From toconnor@vcd.hp.com Mon Mar 12 06:04:39 2001 From: toconnor@vcd.hp.com (Thomas O'Connor) Date: Sun, 11 Mar 2001 22:04:39 -0800 Subject: [Edu-sig] Teaching Python instead of Java? In-Reply-To: Your message of "Sun, 11 Mar 2001 12:49:30 +0100." <20010311124930.E859@se.linux.org> Message-ID: <200103120604.WAA17862@hpvcpto.vcd.hp.com> On Sun, 11 Mar 2001 12:49:30 +0100 David Pettersson wrote: > What I am wondering is if Python is a better alternative, and why if is so. While I have little experience teaching Java to beginning programmers, I am currently assisting a local high school teacher who is using the text: "C++ for You++," to teach an AP programming class. The books makes pretty extensive use of templates and the Advance Placement class libraries very early on. Unfortunately it doesn't even introduce the concept of a class until chapter 15 (out of 21) in the book. What I observe is a significant amount of confusion from the students. They may go through the motions, utilizing code fragments that they copy out of the book, but even the best students don't have the slightest idea what is going on. Java suffers similar problems: Since everything is a class, the concept of a class must either be introduced immediately, or the students must accept on faith that this is something they will eventually learn about and for the present just code classes. The problem is that classes are abstract data types, which are abstract concepts for people new to programming. Another problem with both C++ and Java is that math cannot generally be performed on objects, necessitating frequent conversion between native data types and class instances. Based on my observations of beginning students, I believe that python can provide an interactive, manipulative environment where those students can learn in small chunks without having to have either prior knowledge or faith. At the same time, the language is rich enough to use for introducing advanced concepts such as abstract data types and inheritance. But then, I'm speaking as an observer, not a teacher. Tom O. From Arthinator@aol.com Mon Mar 12 13:17:42 2001 From: Arthinator@aol.com (Arthinator@aol.com) Date: Mon, 12 Mar 2001 08:17:42 EST Subject: [Edu-sig] Raytressi - more relevant than I thought Message-ID: A closer look at Raytressi seems to indicate that it was developed collaboratively as a project at a French technical high school. The download includes a project report. My French is about as good as my C, so I can't make much out of it. But if my facts are right, it seems to me a bit of a milestone in Python's presence in secondary education, perhaps deserving mention on the edu-sig page, and being particularly well suited for use by others who might want to intergrate a raytracing into a math or programming curriculum. Seems to have used Boost to simplify the the C++ extension writing. Have been finally getting into that arena a bit, looking at CXX as part of my effort to understandf the VPython code. Came across Boost recently, which is presenting itself as a more powerful alternative to CXX - allowing, among other things, Python subclassing of C++ classes. But I digress - again. ART From guido@digicool.com Mon Mar 12 14:36:22 2001 From: guido@digicool.com (Guido van Rossum) Date: Mon, 12 Mar 2001 09:36:22 -0500 Subject: [Edu-sig] Raytressi - more relevant than I thought In-Reply-To: Your message of "Mon, 12 Mar 2001 08:17:42 EST." References: Message-ID: <200103121436.JAA18989@cj20424-a.reston1.va.home.com> > A closer look at Raytressi seems to indicate that it > was developed collaboratively as a project at a > French technical high school. > > The download includes a project report. > > My French is about as good as my C, so I can't > make much out of it. > > But if my facts are right, it seems to me a > bit of a milestone in Python's presence in secondary > education, perhaps deserving mention on > the edu-sig page, and being particularly well > suited for use by others who might want to > intergrate a raytracing into a math or > programming curriculum. > > Seems to have used Boost to simplify the > the C++ extension writing. Have been finally > getting into that arena a bit, looking at CXX > as part of my effort to understandf the VPython > code. Came across Boost recently, which > is presenting itself as a more powerful > alternative to CXX - allowing, among other > things, Python subclassing of C++ classes. Art, Could you or someone else give me a line or two of HTML that I can paste into the edu-sig homepage? I don't have time to look further into Raytressi mself to be able to come up with an adequate description, but from what you write I believe it deserves mention! --Guido van Rossum (home page: http://www.python.org/~guido/) From gritsch@iue.tuwien.ac.at Mon Mar 12 14:57:10 2001 From: gritsch@iue.tuwien.ac.at (Markus Gritsch) Date: Mon, 12 Mar 2001 15:57:10 +0100 Subject: [Edu-sig] Raytressi - more relevant than I thought References: Message-ID: <3AACE3C6.F8F9A0F9@iue.tuwien.ac.at> This is a multi-part message in MIME format. --------------DD0CC20E481904297A6A63CA Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Arthinator@aol.com wrote: > ... and being particularly well > suited for use by others who might want to > intergrate a raytracing into a math or > programming curriculum. Recently I improved the povexport.py module which was written by Ruth Chabay, which exports a VPython 3D scene to a POVray-file. I find it very convenient to generate the geometry with VPython code, rotate and zoom the camera at a good-looking location in the scene, and call the export() function to generate the file, which renders exacly the same in POVray. Of course with shadows and optional textures added. Its usage is straight forward, and an example file is included in the zip. file. Enjoy, Markus --------------DD0CC20E481904297A6A63CA Content-Type: application/x-zip-compressed; name="povexport.zip" Content-Transfer-Encoding: base64 Content-Disposition: inline; filename="povexport.zip" UEsDBBQAAAAIAFMEaioElSuY5AIAANoFAAANAAAAcG92ZXhhbXBsZS5weX1UTY/bLBC+8yuQ VpVxiqntJFVViVNPPb2veuhld1WxNkno2mABzsf++s5gx93kUAsbeGae+YDx7Lzr6dGEUXXU 9IPzka7IvBjcUZ9xRcjgjY00+25D9GMTjbPhK31zwFW2pd5FFTWNju51pPGgwaI+GbsH6b7T T/aJXNxIT8pGQem3zjSvSat3Y5hpVns08f9/P4sf6kIb12rxZDNCQgMycZbTfJHljJxMGw/y 8+a6P2izP0S5+XIFXlTzuvduhPgkZSUXNYx8Fqr+xWjISNJSrGesQwMBoMejbqLzrBQbDmJ4 65zTBUwAvFX+PDN37gi0wXyqBXmYoHEAZKFUvEpWCDEHFeWMA8bLnPx+B5WomJPXGwhAYKqz DrIZ/VGzwQX5yIpN4nN2nctl3sxzsbkTgCjnhN49SVBs8mcOB985L5nY8jQgb69aMwZZinIL UezkzqteM3U2QbKi4jCqHASNs7osK8gaVylEVqx5UcPIOapP17DGSGabNfiYPaavuOiuc6f8 akxMhTU5wzPhU0HJAs56K0o8FbCqvHenyeOcKU0MPOvV+tZDc1GW05SD3AEfowrDQfsUMmyu pCXt6tbA3mttc+JBFf6JPZtNLQRQjwcocKsDsutbttctOH2RL+78N+BiDREH86Ylq0TJoSS3 +Knx9N+TewX/SVTvwz+n9OFQ9HTrYpOTg+4M4qlWKMPlmdNLqvXtKhjL6tUZTL8BUn9ErHFh wu4rY8opMat/xQIaGI2xTWcC/lWPWVILAqCM0yxEuNFld3KuXTa9jqqbds9kZzptJ4NZaj+q HzotYLm0gtQ0BDSaBvsIyyl9eIBWFQx2JdoA2SsaXK9PeKt4Gxpg1CXXxhZNr0mIymOouBH4 YVh3LbpeGp+YJtaaMHTqMjUhTjHPsdW/5mTntPO5S74zSAua3JDdDvTcoC27ZojHkOUgECdv oMbRddo2nQsYy8Pcc1d3T3aVIGPR+nD3ZOQPUEsDBBQAAAAIAGC9aSouIpQBvAIAAPkFAAAS AAAAcG92ZXhhbXBsZV93b29kLnB5jVTNjpswEL77KSxFFSY1FJJsVVXi1FNPraqqPeyuVl6Y BHfBRrYJZJ++Y0PoJoeoloU9M56Zb36YvdEtPUrbi4bKttPG0TWZL50+wuhvhHRGKkejr8o6 05dOamU/01eNukJV1GgnHFCn6QEcdTWgRRikOqD00MCDeiAn3dNBKJdS+qWR5Ut41erezmoK jDfx/duv5Ic40VJXkHq9BxURYkuUp2MxnacimzmDrFxdfNyd6RrkoXbF7lNGVquJ9SzKl4PR PaIsKMt4usEdEyJr4YojlE4blvOMZzH584aV8dyzXi5YyERNMYItyt4cgXXaFvcs2QV9zs5n tpy7+Ux2VwIUxZzQqxUEyS5+5JiARpuCpXc87JhTIyrZ2yJLszvuS/PkYHS9AYwr+vn0W+sq zyPER/bF3ogWmBilLViSc9x5jJJSK8iyHBX8LaBnyZYnG9wx98+nHG09yNndBt3PYMI3PUHT 6OEWgtlNOnXFBMMnkk/dUCSd/HCXZj6VqCmM0cOEZU4PDRq+QOvtpe/yJBSnIbpifzMJPhLb 1WBCmEiczS1ZzC9NHwyAumXSII0/wYEt7mdTaMjV2NEKrLe7ubRroHpT5xuIn4tnPf7LQ7LF RFj5CgXL04zTzNcBrftOeGu/FfjvOHH28T+5GUPWsRYwdWi6i0kNjfT80NeU+evI6QkPdLy2 UrHNekTXr8jZvPe8UtuJd93FU1qCZn4T67ICaFS4DVuqspHWIfs+CvZsiqyI08g67LiFGlBj IVpwopmoR7KXDajJVRRmm2i7BlK8LjMmTKQUp1jphxSLKV2tEJSVfuTREpWNoFa3MPje8pUH ZPu3xI8stLwMzXQ6WCVt14jTNLw49WH0FTzNscxRxWS/R0p3oNgZpo8l8oJ0MBJ/JO8gkGWj LbD4PJTXVyuaBf79+c27qxWRv1BLAwQUAAAACACbBWoqxor7hioNAAAhMAAADAAAAHBvdmV4 cG9ydC5wedUaa2/juPG7fwWbYE9ybCu2F4f20nXQfrlDgXbvcCiuH7aBwUi0zV1ZUkkpsbLY /955UBIlZzfOXvo4425DDmeG5HCeIs+FqcqdiHfyVtZTEUuTqa1WYq/SNM9Elek7Zawu69G5 uFtEc7Gcz+ezxXK2+P0IQH+T5kNlxQ9GlzbeiXDLjT/pSkVlda9VFsk4kuUYyaNFtED6xWz+ ejb/DkAXY2FUkcpYJSKwscpUIG5rESTaArQOhILZ6/udMoqxZZIAqi0QYoUsRblT4n2us9KK fCOkiCtz53DjPLPaliorRZHfrUt1KCujRGXlVgmdicLksbJ2LY3J70PgndpcbHJDPO1Obko3 5/5WI5NUb3fllP8Im1cGqKeiKqZCZgkQ3gkJ7LP8XuwAkMI649wYFZdpzYxsvlcAs3tV6hhF nm1hE2VOE8Z5okajs7Ozv++0Ffs8qVIl1KHIDWxNil9+qssdHAgJSUgrfvrxl9nPsnaARNnY 6KLUgIKcotFfcZmWlhbLvTJSpHksCWFj8j3PWcH6YGd32lYybXgblE6cViDpaPQj8ZRpCspR 55XY45SFivWmhlWlIF+Uu8MXG52iTHBSELlwIrco1VF++x5kYaPR9yBimcHe5L6APSI5LLSy aiqsUiIASjcWFXUwgmOEvnDkTsalEw0uEWQ2GtGe3D70HofEBQNtaXS2bYBmo7NkSiozGumd LFd3wDY34WIq5vDfePTeAwJkQcAPfSDCx6NRojZiq8oiT6UJ5fhqJOB3DnLReGSM7mA4rTB5 yScAJw+CEqEtQVTSoLSABZxcbpIxURxqsRL2X6YMZXS4uFiKiZBRDQ0ehtMrJWBIYLAMD3A4 MnrgoWKn2wEgwZEDjxgFp5GJd0Q8RcQb3kNjCRsDmhLCEKpQt50kQXOhwXYLVnwjSiMzm7pu iJpxC2ejwOTcJohkjcxgRUHgYLi6iIYIcL8DpQEwT8dT5gYtjmUF+kHIkTxo2+KABIFPK/yN oeFxO057XAHWu/lNC4QdE2jRgWRVAB8gr4oLcG/eGgYnZvIK+ocZTiNCvWEa8eZaoMKMPcIz QMzP3BF9Q+fRSQ1cTAzKT8xlWuzkYCWECWdAbgWmWqHmTVlhVjPgNX6K4L1HUOjLZTSf0VI8 wrWF81yJJC/D2OTWhkyT5WaPjMbjqdC9TUk4ROsoWqzpYOe0nU71cJIpU3Y4G3NYEd7F4g/z 6LLQ3ki9mn03n9BaHxl9WMHmj+DgukvULWqTJMSbV5up4P+v/5kFnUaUJmtQG839PLanupMV T/NKgJodprhS/Odh/BlkmoiQI8KOCD3q4bPOsRE4M9OZVeCgPF4Q3hSoSQgisWR5AQSGCjwu mFmSg6tOpXXyR7wVO7cQaaci+BTwkDM//PPuCvBuwJX4C+YRGLi68b0ExyP0DmD/TfD8nG8A 521mHBY0xL0m1Ib3Ok0FuHNjdIIhLs0NLwrsZyetBFEhy8CLz8G4cwSl893NqTm2H0WA3tAP 6hPA+OSf3xcE8jmhNLM9LRGOPWtOQ1rHz11YEoQuVK2VwMjEUPGRUN68CovcHsaob9iq29bD eHONTSMTXdnxhtALvd1jfP7IohNme4ssDPhXotsapTJu3qaVAhbi0+gTBUQk55DZ+N/h8l6h HHE1wZVERcV2je2a2w/Yfpi2IvvyL+CFIw23TidUCVEpCMsB7Qi71AAA7gv7+Bc2hxT9bR3F Lm94/Aj+QJuPsN1he/Demd/mBy/Sx0ahKAGIxgpRawvGICFx3rpI4fDAgrPGPzWRZFpPH8Bj qx5O55ggLQTlhWymSdsIDWYaKhhOfpp28fiyQ1h2GEtE6SvdqTrHp9J63xBabgpo1W2rncB3 viF1HDq1a69NJJ0+D2IyC26QCEgvD2iTpC4LcMlRlwM8HeflUZj/qhDP0Vr6ecazIv5XRfvn Rfono/xTEf4c8liqw1wijqqpqUyDyqJUTS68hTLDkI7f5yIvgEaXGB2g9DRUK2DxYGTNJ5bb RT/zno/FDARp9YMSl2LphIk6fIQ36eM94g56BuW5RJzW84rU7RwjdU/zjQGZHJEsG4bL2vUd x+WD65/IEi0MnKKfR00JCnwhh4r6SRQP4RRdAnXaPGycTXxg82wiBBvo6THit+DnfUcf1ykY sOrqugYw9L8N/DQn/KQPfukkANKYolysMF2yHWDJgInsqqq++I53+7L5QmcYvB7fNBzEMw4H eQ7309XtOUwHSc7/Q0ZCX7xaLe2zdjU3RLFUZSEd+Vhci0WXYmuMh13Zy8U4AN94FDMPH3+s UhTNYPid1jfHw0tveLLoI1BQdQK8FvM+c/wZ/kbAKH3eqVWfwd/Lbcgrm/EKxpfL+TzqIbcZ mxRJtd/XrZpjusXy7OHHMO4ZAxrpiudw4ZdnmjUwXvHKmCkbK1gZ/UUZfVnNSFlW7rvIFAOo voWQPh/31wNJfJvK91bztTOfNu9p5VrzQ6n1qrNVv1o7JoANnUzgazhU20N3jZNj4O/XaDjD YEuo+KibLfQLav2ycn9a5qfL+2TRPS62I/EkKmURdr127AlHhMVz64cgDavsMFQS0MXJLsph 5NprSDh/fdijVbpCZB5hDoj/YEo0vxaXl5DA6m0m7nW58+uz/0Lp8iurlL5XH8iWAvNR+S0C T6YIL3c6/pBBYDox3r1o9tcmrXQgL5+q/ua+I/ClU2MtRQ2z6mRoL0wsPv7Ew7/OLmwsU9Jb aji9pXbttVtVb82Iaik4qv+xAaXk2SAp2ZY7guwYslMy8aCWoOkMRs8Fw7Eg5es8Irtvye51 0lAxkLA66LlALL7MKfwjKKhM9jPoi9Cml9J5zaeMfdU3df9KYo/x50gbyML52IKr3f3UdcCE dmnTeaCRJ2ylNcIXtsEXzLZbt4NS7nkeAvjOhwAPTr1ZckMj3i/G3ejAZHHMnTMdPB/0bX74 o8gUfsXOh9kijPEB44cN+nZAucBjioBfYlyO2B842n/7XWgqSPVWvh5OQQXxIrcPHLLoZR7T z+QXMIvLMPaYnPvfM+Efb2QopmWXC3SY53i9HoNwMhSQ01jxTSuivrME8U+A0SmOEdh21Qx2 juptvPn4qs/pJ9XeL5SJdJ4LmQ+8xSMS6u/0pJCOofQJY+LfS1Xt/4FPWS8etp8VtZ8ZtEP3 LGX1Fg5r2jx6WOMjCAKNr9AuHNL08ccRNA2k9w5LrFYCSa9agZyLLG9Huys1m7sPynGp71SD 0IqY/VNboTxSUrQTMm50xAHMm0acU9Sb3gbbhbYEzSiKU7SfGvoF+hCnd8MKpnTAy0N/mn5x MyDvdSciOG8kexZMgBVAznACXn6mSy1TOMM9GS/5Dkhg+Msy3/8136ETfHNEr07wlKOi5icl yKYJxagE7H6Ax/d5ZWZW40ukxvHxS5OdLBSoPixrCokI+u20xqc8dITR6DxRcYrvV1w+Bxyr DC8d2JuVRtN3fLD9NzN+jjJb4LXNxO+4JylNVucTTR4hmjxFNPPxvoqot9aniWY+EXPg9uJJ ot4GB0QuvY2+pQVE3143SgQHBsbDYRQkThEU/i6ciyZi98RrGGq2aX4LOmRVWUJtC5Vri8iP wFwkACC7/34DV9bOcCvjD1u6Wzq6v2tHnhdhWta0liFXBvIrNZTjFyMlselNrbOSMfqNa19o /KzsKDzzYzNWaUNigkOMXr/mO5nr5lDcFVFllWW0Gb6ao0dzuUkiYWsLnHmDzcO1E3ZhP9SI VhUOqyrqptHipHn+YS3LE+9DWRVfhZv8ziUE/dJo3hPKubhVeAns/AyoTlU4V0KQwZdZHzhZ HXmtydDnef7oMfojPaZEAqDBlfP3kUO5WMyd4QxYPKaonI5goG64dFhQyJz+AR1+TYx/hNPi mZw4OXiE0fIG9kasMMhoDDLS4GvLED9qNwRkInYMUfscX6GaPKnAVpxe0iC+BgnxsSH4egmV 1m1Vim2eQxQuAP2g96SWXYxNnY/pz/BO38AMfDWJS0k0Pgp1T9sIxYuXkFDja1vB37NpdEyP g5qBhkaEMnXL5EeR9ztdqm4tBdWodI3ruFwAy0O7e5IHAhdzSCTxHlwaIe9BZ6HusXpf0ckX ILc0VelgnQOdGXig/jVq/xa1f4n6nBsdOHCQQnDViuLi28vXUXPQMe+32d0+B8cSsS/i8dJ4 w951dEz1VzMAxorAwf6Gns7bYNzfYdzfYvy8PQbgtoCoKogjuC7u1NR54M4zuLl0HbbuZ+vY 9ZJ17D6DJ3jBzuSgg18ILgvt2xtkz6zmjMTJtO0yOwCsM3xLusK3uSF0o/UaEiPI4ted/m6q jIykQQ1cfRiAF2w4HCEDHsdsG46jrSrDHpfe9/VmpJ9x9quFBgfX2L89GCiIXzA0KMdXVTBr u/ffwY6oZgmO708KAzougn/8+ee3f3n7w5WrPrpNopB9MdDrN3JT+GgaAwe4aj4PV9B4yx2N RrCONRGu15jWB+v1XupsvXZL4enX6ySP1+vRvwFQSwECFAAUAAAACABTBGoqBJUrmOQCAADa BQAADQAAAAAAAAABACAAtoEAAAAAcG92ZXhhbXBsZS5weVBLAQIUABQAAAAIAGC9aSouIpQB vAIAAPkFAAASAAAAAAAAAAEAIAC2gQ8DAABwb3ZleGFtcGxlX3dvb2QucHlQSwECFAAUAAAA CACbBWoqxor7hioNAAAhMAAADAAAAAAAAAABACAAtoH7BQAAcG92ZXhwb3J0LnB5UEsFBgAA AAADAAMAtQAAAE8TAAAAAA== --------------DD0CC20E481904297A6A63CA-- From matthias@rice.edu Mon Mar 12 15:34:34 2001 From: matthias@rice.edu (Matthias Felleisen) Date: Mon, 12 Mar 2001 09:34:34 -0600 (CST) Subject: [Edu-sig] Re: Teaching Python instead of Java? (Jeffrey Elkner) In-Reply-To: (edu-sig-request@python.org) References: Message-ID: <200103121534.JAA14416@africa.cs.rice.edu> Hi David! Thanks for your interest in exploring Python as an introductory programming language! I am a high school teacher who has been using Python to teach our intro course for two years now. I have never seen a better language for that purpose. The main aim when teaching students to program is to give them an understanding of the processes of thought and the underlying concepts used in getting a machine to follow their will. This is a daunting task, and no programming language could make teaching students to think logically easy. Sorry, it's not about machines at all. It is about formulating computational solutions that people read, modify, extend, debug. The machine comes last, and the point of high-level language is to hide the machine. Totally. Period. The best programming language in the world for teaching programming would be one that does not add any additional overhead to the problem of teaching students to understand variables, conditional branches, and loops. As a Python programmer yourself I'm sure you will understand when I say that Python does that better than any other language I know of. I question the "loop" part. You want to match the program organization to the data organization. Loops hardly ever match, unless all your data are linear (natural numbers, lists). XML is all about trees. No sound mind should process them with loops. And students should be able to mainpulate XML-like stuff after a few weeks or so with total ease. To be concrete about this, let's compare Python with Java. I agree with you that Java is a fine language (and it is definite improvement over C++ for beginners), but it can't compare with Python as a first language. Why don't you compare Python with a true competitor such as Scheme? It has the same advantages as Python, has been around much longer, is regular, and is already taught at hundreds of colleges and high schools. -- Matthias Matthias Felleisen Professor of Computer Science Rice University For a new way to look at the world of high school computing, see http://www.teach-scheme.org/ http://www.htdp.org/ "Computer Science is no more about computers than astronomy is about telescopes." -- E. W. Dijkstra From pdx4d@teleport.com Mon Mar 12 17:40:44 2001 From: pdx4d@teleport.com (Kirby Urner) Date: Mon, 12 Mar 2001 09:40:44 -0800 Subject: [Edu-sig] Teaching Python as a gateway to teaching whatever... In-Reply-To: <200103121534.JAA14416@africa.cs.rice.edu> References: Message-ID: <3.0.3.32.20010312094044.0396b560@pop3.norton.antivirus> >Why don't you compare Python with a true competitor such as Scheme? > >It has the same advantages as Python, has been around much longer, is >regular, and is already taught at hundreds of colleges and high schools. > >-- Matthias In theory, we have a lot of latitude regarding how to craft a course, even at the high school level. Given that Python incorporates a lot of features common to other languages, it's useful for developing some ideas and skills with an eye towards introducing other languages as well. I always appreciated my intro classes in college for precisely this approach: part of the aim was to open our eyes to the huge number of languages out there and something about their history as well. I got some hands-on experience with a sampling, and really enjoyed that. In sum, I think a dynamite intro to programming course might use Python as a base of operations within which to develop concepts Mr. Elkner was listing etc. (branching, looping, resursion, procedure, class/subclass/object, data types, arrays), and then get into something of the rich heritage a contemporary student inherits, if willing. Speaking of the tree structure, how languages tend to grow on trees is useful information. Show the LISP family tree, give some sense of its nomenclature and current state. Download DrScheme and introduce some of the basics. Do the same with a LISP (which has a loop construct and relies far less on recursive strategies -- unless in the hands of a Schemer). Talk about SmallTalk and Squeak -- dive into it for a few days. Maybe use Jython as an intro to Java. Then talk pure Java. Use this as a bridge back to C/C++ and, coming full circle, touch on CPython as C code, and how to extend same. Did I forget to mention Perl? Tsk. And what about Haskell and ISETL and FORTRAN and APL and... obviously it's up to the teacher what to cover in finite time. But what's so cool about getting your intro today, vs. X years ago, is you've got a lot of free resources and GUI versions of just about all of the above. It's a rich and well-supplied environment, all there, ready to be explored. What I'd like to see in a next generation of programmers is less propensity to indulge in language wars of any kind -- especially of the pointless kind, as if the aim were to make the "competition" simply go away and to envision an "ideal world" wherein everyone eventually sees the light and programs in language X (whatever language X might be). So many religions have made this mistake, and I think the less of them for it. So when we teach Python as a first language, I _hope_ the attitute isn't going to be to encourage snobbery and "my language is better than yours" attitudes. On the contrary, _all_ the languages are part of your common heritage, and you can use any of several to leverage your understanding of all the others. To me, this is what any "introduction to programming" is really about, at least initially. It's about learning some of the basic concepts (and that includes knowing something about how computers work) and it's about getting some overview and feel for the evolutionary picture, the zoology, the taxonomy. It's not about studying just one animal in the zoo the whole day, and ignoring all the other creatures. And finally, in an even "grander" scheme of things, I'm looking at ordinary non-computer languages in the same overview, starting with the math notations, with all their varied syntax and symbols. Math languages have had a big influence in computer language from the start -- except I think it's increasingly a two way street, with the bidirectional aspect becoming clearer by the day. So I'm all for a hybrid of computer science and concrete mathematics which draws examples of what to program from the math texts, and which shows students how language X is managing to implement some of the same ideas as embodied in math notation Y (boolean algebra is a good place to start, then maybe loops of the kind signified by Sigma and Pi, then gcd and lcm... etc. etc. See: http://www.inetarena.com/~pdx4d/ocn/overcome.html -- which is mostly addressed to math teachers, as I don't believe in necessarily putting computers on one side of a bureaucratic turf divide and math courses on the other -- leaving serious math teachig to the graphing calculator crowd seems a serious misallocation of resources in my book). I'll try to summarize with a course outline, drawn off the top of my head and on the spot: Introduction to Computer Programming Cardinality (numbers as names) Looking at serial numbers, social security numbers, license plate alpha-numeric strings, and talking about the pervasiveness of databases in our culture (record keeping) Videoclip possibilities: airline reservations, talking heads re their jobs, clips from the movie 'Brazil' (welcome to information retrieval -- metropolis/bureaucracy/art deco) -- I recommend short vidclips from your school's DVD juke box wherever appropriate (won't continue listing them here, as your school probably doesn't have a repository in any case). http://www.inetarena.com/~pdx4d/ocn/cardinality.html Ordinality (numbers in order) quick review of integers and real numbers, with an eye towards data types and the computer concepts of floating point, double precision, big numbers, integers, negatives numbers (ties forward to later mention of binary representations, 2s complement etc). Emphasize the importance of operators > < = in an ordered system, plus the appearance of operations such as + / * - (quick mention of groups, fields and rings, just as an aside and the fact that these are topics in algebra) Positional Notation and Bases talk about base 10, other bases, with strong links to the abacus as the artifact that makes all this rather easy to think about. Start introducing Python, including a module with lots of precoded methodes having to do with bases and base conversion. Show the binary strings corresponding to integers. Binary representation ASCII more use of Python to show bytes as 8-bits, some discussion of the history of ASCII, leading up to a discussion of: Unicode visit the Unicode website and take a look at some of the PDFs showing the symbols/glyphs covered by this system. Talk about powers of 2, and the space of permutations depending on how many bits in a string (2^N). Review: http://www.inetarena.com/~pdx4d/ocn/intro0.html Computer Languages History of Computers and Computing Devices Start with the abacus, move through navigation as a principle challenge for humans and the development of knowledge and instrumentation in that domain, and ballistics. The importance of ciphers, codes, cryptology should be emphasized, with this thread picked up in WWII. Discuss Alan Turing at Bletchy Park, the German Enigma codes. Use Python to play with the rotor module. Clubhouse codes. Mention Ada Byron and some of the controversy around her 'first computer programmer' title. http://www.teleport.com/~pdx4d/adaessay.html Talk about Grace Hopper and COBOL, and the idea of a compiler. Overview of Compiler, Interpreter, Bytecodes, Virtual Machine, libraries, linking, Assembly Language, chips as having instruction sets, registers, access to short and longer term memeory via bus, RISC, MIX, MMIX (talk about Knuth's multi- volume classic without trying to make this a college course about it). Getting into it with Python Overview Discuss its lineage/heritage, how it's a VHLL coming out after a long history of language evolution, and how we'll therefore be using it to study earlier life forms and other branches of the evolutionary tree, down to live/evolving languages in contemporary use. http://www.inetarena.com/~pdx4d/ocn/cp4e.html Data Types and Data Structures, Conversion Strings, floats, integers, long numbers Types, attributes, lists, tuples, dictionaries Managing Program Flow Branching, looping, recursion, calling and returning, mapping (includes list comprehension) Functions and Methods parameters, functions as objects with attributes, passing functions as parameters (optional, by name) Classes/Subclasses and Objects [this is where I usually swap in Polyhedra as objects and/or Groups as objects, after some simpler examples] Managing with Modules Scope issues, namespaces, importing, documenting << SNIP >> Kirby From Arthinator@aol.com Tue Mar 13 02:26:11 2001 From: Arthinator@aol.com (Arthinator@aol.com) Date: Mon, 12 Mar 2001 21:26:11 EST Subject: [Edu-sig] Teaching Python instead of Java? Message-ID: Mathias writes - >Sorry, it's not about machines at all. It is about formulating >computational solutions that people read, modify, extend, debug. >The machine comes last, and the point of high-level language is >to hide the machine. Totally. Period. Yes - the word machine was in Jeff's sentence >I question the "loop" part. You want to match the program organization to >the data organization. Loops hardly ever match, unless all your data are >linear (natural numbers, lists). XML is all about trees. No sound mind >should process them with loops. And students should be able to mainpulate >XML-like stuff after a few weeks or so with total ease. But XML wasn't, was it? >Why don't you compare Python with a true competitor such as Scheme? Good enough advice. Never heard much other than deep respect for Scheme - even when haunting Python lists. >For a new way to look at the world of high school computing, >see > http://www.teach-scheme.org/ >http://www.htdp.org/ Been there. Like programming languages. Agree with Kirby - the more the better. Don't like programming environments - for Scheme or Python. I should be your audience - a liberal artist with an intellectual curiosity about programming. But the limited time I have to devote to the pursuit I want use to learn programming, not orienting myself to an environment. What do you recommend to someone who wants to get at Scheme with the copy/cut/paste/run text editor of his choice. ART From jcm@bigskytel.com Tue Mar 13 06:31:43 2001 From: jcm@bigskytel.com (David Porter) Date: Mon, 12 Mar 2001 23:31:43 -0700 Subject: [Edu-sig] Teaching Python instead of Java? In-Reply-To: ; from Arthinator@aol.com on Mon, Mar 12, 2001 at 09:26:11PM -0500 References: Message-ID: <20010312233143.A10260@bigskytel.com> * Arthinator@aol.com : > Matthias writes - [...] > >For a new way to look at the world of high school computing, > >see > > > http://www.teach-scheme.org/ > >http://www.htdp.org/ > > Been there. Like programming languages. Agree with > Kirby - the more the better. Don't like programming environments - > for Scheme or Python. I should be your audience - a liberal artist > with an intellectual curiosity about programming. But the limited > time I have to devote to the pursuit I want use to learn programming, > not orienting myself to an environment. > > What do you recommend to someone who wants to get at Scheme > with the copy/cut/paste/run text editor of his choice. The graphical environment is an extension to mzscheme. You don't have to use it. http://www.cs.rice.edu/CS/PLT/packages/mzscheme/index.html David From jeff@elkner.net Tue Mar 13 12:08:13 2001 From: jeff@elkner.net (Jeffrey Elkner) Date: 13 Mar 2001 07:08:13 -0500 Subject: [Edu-sig] Cards n stuff... Message-ID: <200103131216.HAA02030@angelo.arlington.k12.va.us> Hi All! Could anyone point me to some good examples of classes for cards and decks, with shuffle methods, etc. I have a student writing a blackjack program, so the info would be a big help. Thanks. jeff From guido@digicool.com Tue Mar 13 12:27:52 2001 From: guido@digicool.com (Guido van Rossum) Date: Tue, 13 Mar 2001 07:27:52 -0500 Subject: [Edu-sig] Cards n stuff... In-Reply-To: Your message of "13 Mar 2001 07:08:13 EST." <200103131216.HAA02030@angelo.arlington.k12.va.us> References: <200103131216.HAA02030@angelo.arlington.k12.va.us> Message-ID: <200103131227.HAA30999@cj20424-a.reston1.va.home.com> > Hi All! > > Could anyone point me to some good examples of classes for > cards and decks, with shuffle methods, etc. > > I have a student writing a blackjack program, so the info > would be a big help. Thanks. > > jeff Try PySol. http://wildsau.idv.uni-linz.ac.at/mfx/pysol/ --Guido van Rossum (home page: http://www.python.org/~guido/) From jeff@elkner.net Tue Mar 13 16:58:37 2001 From: jeff@elkner.net (Jeffrey Elkner) Date: 13 Mar 2001 11:58:37 -0500 Subject: [Edu-sig] Cards n stuff... In-Reply-To: <200103131227.HAA30999@cj20424-a.reston1.va.home.com> References: <200103131216.HAA02030@angelo.arlington.k12.va.us> <200103131227.HAA30999@cj20424-a.reston1.va.home.com> Message-ID: <200103131706.MAA11809@angelo.arlington.k12.va.us> Thanks, Guido, but PySol is *WAY* too difficult for 1st year students. The GUI isn't seperated from the logic, so they would need to have a good understanding of TkInter to be able to make any sense of it. They are getting their first exposure to OOP, so I wanted and example that was simple. Here is what I gave them: class Card: def __init__(self, suite, rank): self.suite = suite self.rank = rank class Deck: def __init__(self): self.cards = [] for suite in range(4): for rank in range(1, 14): newCard = Card(suite, rank) self.cards.append(newCard) The game will be text based, so what I am looking for is a simple example with shuffle methods, etc. On 13 Mar 2001 07:27:52 -0500, Guido van Rossum wrote: >> Hi All! >> >> Could anyone point me to some good examples of classes for >> cards and decks, with shuffle methods, etc. >> >> I have a student writing a blackjack program, so the info >> would be a big help. Thanks. >> >> jeff > > Try PySol. > > http://wildsau.idv.uni-linz.ac.at/mfx/pysol/ > > --Guido van Rossum (home page: http://www.python.org/~guido/) From agauld@crosswinds.net Tue Mar 13 18:14:48 2001 From: agauld@crosswinds.net (Alan Gauld) Date: Tue, 13 Mar 2001 18:14:48 +0000 Subject: [Edu-sig] Teaching Python instead of Java? Message-ID: <3aae662c.c3.0@crosswinds.net> >- It supports multiple programming paradigms: > procedural, modular, and object-oriented. And let's not forget functional programming too. Some students find functional concepts easier to absorb than OO! >'built on top of' procedural features (which are closer > to how the computer really works). Closer to most computers but not all. Symbolics workstations are optimised to work with Lisp and Dr David H???? built an OO based machine some time back for Linn Products which was all based on message passing at the hardware level. But I agree that most computers are stack based. >- It is an alternative to Java. It doesn't make > sense to teach everyone the same language It doesn't make sense to teach anyone Java except, maybe, as an alternative to C++. Java is an apalling language for a beginner being riddled with inconsistencies (although Java 2 is much better) and based on a pseudo OO design that positively encourages bad OO programming practices. Java is really a Class Oriented Design rather than Object Oriented. As Jeff stated earlier Python focuses on the principles with minimal distraction. Java is an acceptable language for large scale network programming. For teaching it stinks IMHO! Python isn't perfect, but it seems to be the best we have for now - and I include Ruby and Scheme... Alan G. Author of "Learning to Program" at: http://www.crosswinds.net/~agauld From agauld@crosswinds.net Tue Mar 13 18:21:51 2001 From: agauld@crosswinds.net (Alan Gauld) Date: Tue, 13 Mar 2001 18:21:51 +0000 Subject: [Edu-sig] Teaching Python instead of Java? Message-ID: <3aae67d3.21f.0@crosswinds.net> >... Another problem with both C++ and Java is that math >cannot generally be performed on objects, True in Java. But C++ at least allows classes to be built to fully mimic(well very nearly :-) primitive types. Thus provided operator overloading has been done you can perform math and any other native operation on an object. Java with its simplified model prevents this except by using a mixture of methods and operators. And of course you'll need to implement a value class heirarchy of your own coz Jave doesn't have one... With C++ you get a much stronger OO model but at the expense of simplicity. In Java you get memory management but at the expense of a broken object model and only slightly reduced complexity. In Python you get everything, including simplicity at the expense of a little speed compared to C++! For teaching Python wins every time. Alan G. From pdx4d@teleport.com Tue Mar 13 19:04:51 2001 From: pdx4d@teleport.com (Kirby Urner) Date: Tue, 13 Mar 2001 11:04:51 -0800 Subject: [Edu-sig] Cards n stuff... In-Reply-To: <200103131706.MAA11809@angelo.arlington.k12.va.us> References: <200103131227.HAA30999@cj20424-a.reston1.va.home.com> <200103131216.HAA02030@angelo.arlington.k12.va.us> <200103131227.HAA30999@cj20424-a.reston1.va.home.com> Message-ID: <3.0.3.32.20010313110451.00b3b100@pop3.norton.antivirus> Hi Jeff -- Here's a slightly modified version of your code, including some ideas about shuffling: import random class Card: def __init__(self, suite, rank): self.suite = suite self.rank = rank def __repr__(self): return self.rank + ' of ' + self.suite class Deck: suites = ['Hearts','Diamonds','Spades','Clubs'] ranks = ['Ace']+map(str,range(2,11))+['Jack','Queen','King'] def __init__(self): self.cards = [] for suite in Deck.suites: for rank in Deck.ranks: newCard = Card(suite, rank) self.cards.append(newCard) def shuffle(self): newdeck = [] while len(newdeck)<52: randomcard = random.choice(self.cards) newdeck.append(randomcard) self.cards.remove(randomcard) self.cards = newdeck Note: I manually truncated/edited the list of cards to save space. >>> mydeck = cards.Deck() >>> mydeck.cards [Ace of Hearts, 2 of Hearts, 3 of Hearts, 4 of Hearts, 5 of Hearts, 6 of Hearts, 7 of Hearts, 8 of Hearts, 9 of Hearts, 10 of Hearts, Jack of Hearts, Queen of Hearts, King of Hearts, Ace of Diamonds...] >>> mydeck.shuffle() >>> mydeck.cards [Ace of Spades, 9 of Hearts, 7 of Spades, Queen of Diamonds, 3 of Hearts, Jack of Spades, 10 of Clubs, 4 of Spades, 10 of Hearts, Queen of Spades, 7 of Diamonds, Ace of Hearts, Queen of Hearts, Queen of Clubs, 6 of Spades, King of Hearts...] >>> len(mydeck.cards) 52 From dave@se.linux.org Tue Mar 13 19:42:42 2001 From: dave@se.linux.org (David Pettersson) Date: Tue, 13 Mar 2001 20:42:42 +0100 Subject: [Edu-sig] Teaching Python instead of Java? In-Reply-To: <20010311124930.E859@se.linux.org>; from dave@se.linux.org on Sun, Mar 11, 2001 at 12:49:30PM +0100 References: <20010311124930.E859@se.linux.org> Message-ID: <20010313204241.A10754@se.linux.org> On Sun, Mar 11, 2001 at 12:49:30PM +0100, David Pettersson wrote: > What I am wondering is if Python is a better alternative, and why if is so. Thank you all for sharing your opinions on the subject. I have to collect my thoughts a bit now, and then try and see how I can convince the right people at the department ;-). Sincerely, -- David Pettersson Stardate [-30]6324.09 dave@se.linux.org Public key available on request From schoen@loyalty.org Tue Mar 13 20:08:21 2001 From: schoen@loyalty.org (Seth David Schoen) Date: Tue, 13 Mar 2001 12:08:21 -0800 Subject: [Edu-sig] Cards n stuff... In-Reply-To: <3.0.3.32.20010313110451.00b3b100@pop3.norton.antivirus>; from pdx4d@teleport.com on Tue, Mar 13, 2001 at 11:04:51AM -0800 References: <200103131227.HAA30999@cj20424-a.reston1.va.home.com> <200103131216.HAA02030@angelo.arlington.k12.va.us> <200103131227.HAA30999@cj20424-a.reston1.va.home.com> <200103131706.MAA11809@angelo.arlington.k12.va.us> <3.0.3.32.20010313110451.00b3b100@pop3.norton.antivirus> Message-ID: <20010313120821.B18059@zork.net> Kirby Urner writes: > Hi Jeff -- > > Here's a slightly modified version of your code, including > some ideas about shuffling: > > import random > > class Card: > > def __init__(self, suite, rank): > self.suite = suite > self.rank = rank > > def __repr__(self): > return self.rank + ' of ' + self.suite > > class Deck: > > suites = ['Hearts','Diamonds','Spades','Clubs'] > ranks = ['Ace']+map(str,range(2,11))+['Jack','Queen','King'] > > def __init__(self): > self.cards = [] > for suite in Deck.suites: > for rank in Deck.ranks: > newCard = Card(suite, rank) > self.cards.append(newCard) > > def shuffle(self): > newdeck = [] > while len(newdeck)<52: > randomcard = random.choice(self.cards) > newdeck.append(randomcard) > self.cards.remove(randomcard) > self.cards = newdeck > > > > Note: I manually truncated/edited the list of cards to save > space. > > >>> mydeck = cards.Deck() > >>> mydeck.cards > [Ace of Hearts, 2 of Hearts, 3 of Hearts, 4 of Hearts, 5 of Hearts, > 6 of Hearts, 7 of Hearts, 8 of Hearts, 9 of Hearts, 10 of Hearts, > Jack of Hearts, Queen of Hearts, King of Hearts, Ace of Diamonds...] > > >>> mydeck.shuffle() > >>> mydeck.cards > [Ace of Spades, 9 of Hearts, 7 of Spades, Queen of Diamonds, 3 of Hearts, > Jack of Spades, 10 of Clubs, 4 of Spades, 10 of Hearts, Queen of Spades, > 7 of Diamonds, Ace of Hearts, Queen of Hearts, Queen of Clubs, 6 of Spades, > King of Hearts...] > >>> len(mydeck.cards) > 52 An interesting question is whether methods of a Deck which modify the order of the deck should return None (and modify that Deck object) or return a new Deck to which the change has been applied. In general, I think the latter is better. But there is an argument that the programmer who wants to keep an old Deck object should assume the responsibility of making a copy. Here's your code with methods added to do in-shuffles and out-shuffles on an existing deck: import random class Card: def __init__(self, suite, rank): self.suite = suite self.rank = rank def __repr__(self): return self.rank + ' of ' + self.suite class Deck: suites = ['Hearts','Diamonds','Spades','Clubs'] ranks = ['Ace']+map(str,range(2,11))+['Jack','Queen','King'] def __init__(self): self.cards = [] for suite in Deck.suites: for rank in Deck.ranks: newCard = Card(suite, rank) self.cards.append(newCard) def shuffle(self): newdeck = [] while len(newdeck)<52: randomcard = random.choice(self.cards) newdeck.append(randomcard) self.cards.remove(randomcard) self.cards = newdeck def interleave(self, a, b): c = [] while b and a: c.append(b.pop()) c.append(a.pop()) if b: c.append(b.pop()) if a: c.append(a.pop()) c.reverse() return c def out_shuffle(self): L = len(self.cards) self.cards = self.interleave(self.cards[:L/2], self.cards[L/2:]) def in_shuffle(self): L = len(self.cards) self.cards = self.interleave(self.cards[L/2:], self.cards[:L/2]) (I'm not actually sure this works properly if there are an odd number of cards in the deck.) For fun, you can then try d = Deck() for i in range(52): d.in_shuffle() print d.cards d = Deck() for i in range(8): d.out_shuffle() print d.cards I would really very much like to have a function that simulates a typical human shuffle -- I and most of the people I know can't do anything like perfect faro shuffles -- but it's hard to think of a good model. We know that most people make an imperfect division of the deck which is _approximately_ event, and then let fall a certain number of cards at a time (a "run") from one half, followed by a run from the other side, and so on back and forth until one side runs out. The biggest question is the lengths of the runs. They aren't all the same; a more experienced shuffler will tend to have shorter average runs. How are run lengths distributed (for a given shuffler), and how are they correlated to previous run length or to distance into the deck? Are the runs from one half of the deck (say, the half held in the shuffler's non-dominant hand) typically longer than the runs from the other half? You can get dealing easily by def deal(self): if self.cards: card = self.cards[0] self.cards.remove(card) return card else: return None -- Seth David Schoen | And do not say, I will study when I Temp. http://www.loyalty.org/~schoen/ | have leisure; for perhaps you will down: http://www.loyalty.org/ (CAF) | not have leisure. -- Pirke Avot 2:5 From pdx4d@teleport.com Tue Mar 13 20:10:25 2001 From: pdx4d@teleport.com (Kirby Urner) Date: Tue, 13 Mar 2001 12:10:25 -0800 Subject: [Edu-sig] Cards n stuff... In-Reply-To: <3.0.3.32.20010313110451.00b3b100@pop3.norton.antivirus> References: <200103131706.MAA11809@angelo.arlington.k12.va.us> <200103131227.HAA30999@cj20424-a.reston1.va.home.com> <200103131216.HAA02030@angelo.arlington.k12.va.us> <200103131227.HAA30999@cj20424-a.reston1.va.home.com> Message-ID: <3.0.3.32.20010313121025.00b3b100@pop3.norton.antivirus> Variation on the 'deck of cards' theme: """ this is cards.py """ import random # used when shuffling deck from operator import add # used to add card values # putting suites and ranks at the module level makes them global suites = ['Hearts','Diamonds','Spades','Clubs'] # creating a dictionary pairing character rank with integer value, # i.e. ranks['Queen'] = 12. Could do this with a loop instead of # with such a complicated eval expression -- below works in Python 2.0+ ranks = eval('{' + ','.join(["'%s':%s" % x for x in zip(['Ace']+map(str,range(2,11))+['Jack','Queen','King'], range(1,15))])+'}') class Card: """ a single card """ def __init__(self, suite, rank): self.suite = suite self.rank = rank def value(self): """ return how much I'm worth (in some games, all face cards might have same value) """ return ranks[self.rank] # my dictionary value def __repr__(self): """ my fancier name """ return self.rank + ' of ' + self.suite class Deck: """ a single deck of cards """ def __init__(self): """ Initialize me automatically -- including a shuffle """ self.cards = [] for suite in suites: for rank in ranks.keys(): newCard = Card(suite, rank) self.cards.append(newCard) self.shuffle() def shuffle(self): """ shuffle any time """ newdeck = [] while len(newdeck)<52: randomcard = random.choice(self.cards) newdeck.append(randomcard) self.cards.remove(randomcard) self.cards = newdeck def deal(self,numcards,hand): """ deal numcards off the top to hand object """ hand.cards = self.cards[:numcards] self.cards = self.cards[numcards:] class Hand: """ a single hand """ def __init__(self): self.cards = [] def __repr__(self): return str(self.cards) def value(self): """ add the values of all cards in hand """ return reduce(add,[card.value() for card in self.cards]) def setup(): global thedeck,myhand thedeck = Deck() thedeck.shuffle() myhand = Hand() thedeck.deal(2,myhand) =========== Usage: >>> reload(cards) >>> cards.setup() >>> cards.myhand [4 of Diamonds, 5 of Diamonds] >>> cards.myhand.value() 9 >>> cards.setup() >>> cards.myhand [7 of Spades, 8 of Hearts] >>> cards.myhand.value() 15 >>> mydeck = cards.Deck() # make me a deck >>> mydeck.cards[0:3] # peak at top 3 cards [3 of Diamonds, Ace of Hearts, 6 of Spades] >>> myhand = cards.Hand() # initialize a hand.. >>> mydeck.deal(2,myhand) # and deal it 2 cards from mydeck >>> myhand.cards # hand gets first 2 cards off the top [3 of Diamonds, Ace of Hearts] >>> mydeck.cards[0:3] # deck now has 6 of Spades as top card [6 of Spades, 7 of Spades, Queen of Spades] From smorris@cereva.com Wed Mar 14 00:05:06 2001 From: smorris@cereva.com (Morris, Steve) Date: Tue, 13 Mar 2001 19:05:06 -0500 Subject: [Edu-sig] Teaching Python instead of Java? Message-ID: <8010912471E0D41189930090278D4E480FF258@SPAWN> > >'built on top of' procedural features (which are closer > > to how the computer really works). > > Closer to most computers but not all. Symbolics > workstations are optimised to work with Lisp and > Dr David H???? built an OO based machine some time > back for Linn Products which was all based on > message passing at the hardware level. But I > agree that most computers are stack based. Ah yes Symbolics... It is best to speak politely of the dead but this we can say: both of these machines implemented a complex abstraction in microcode. The underlying machines that interpreted the microcode were procedural, i.e. "how computers really work." Microcode is software and hides the underlying architecture but it is still there. There is little conceptual difference between a microcode interpreter and a Python interpreter. Neithor represent the actual hardware layer, i.e. "how a computer really works." Microcode is more correctly called firmware but so is PCs BIOS. There are/were non procedural computers but these two computers are not in that list. From pdx4d@teleport.com Wed Mar 14 01:24:24 2001 From: pdx4d@teleport.com (Kirby Urner) Date: Tue, 13 Mar 2001 17:24:24 -0800 Subject: [Edu-sig] Cards n stuff... In-Reply-To: <3.0.3.32.20010313121025.00b3b100@pop3.norton.antivirus> References: <3.0.3.32.20010313110451.00b3b100@pop3.norton.antivirus> <200103131706.MAA11809@angelo.arlington.k12.va.us> <200103131227.HAA30999@cj20424-a.reston1.va.home.com> <200103131216.HAA02030@angelo.arlington.k12.va.us> <200103131227.HAA30999@cj20424-a.reston1.va.home.com> Message-ID: <3.0.3.32.20010313172424.0095bd20@pop3.norton.antivirus> Just for the fun of it, I added a little more code, tweaked what I already had, to make a game _something like_ Blackjack. I say _something like_ because I don't actually know much about card games and I've probably messed up the rules some -- plus I left out the whole thing about money, and there's only one other player etc. etc. -- plenty of room for improvement. A game loop looks like this: >>> reload(cards) >>> cards.play() Your hand: [6 of Diamonds, 2 of Diamonds], Value: 8 Other guy: [8 of Diamonds, 6 of Clubs], Value: 14 Do you want a card? (Y/N)y Your hand: [6 of Diamonds, 2 of Diamonds, 10 of Spades], Value: 18 Other guy: [8 of Diamonds, 6 of Clubs, 8 of Spades], Value: 22 You win!! Play again? (Y/N)y Your hand: [7 of Diamonds, 8 of Diamonds], Value: 15 Other guy: [Ace of Spades, Ace of Diamonds], Value: 2 Do you want a card? (Y/N)n Your hand: [7 of Diamonds, 8 of Diamonds], Value: 15 Other guy: [Ace of Spades, Ace of Diamonds, 9 of Hearts], Value: 11 You win!! Play again? (Y/N)n The module is here: http://www.inetarena.com/~pdx4d/ocn/python/cards.py Kirby From agauld@crosswinds.net Wed Mar 14 09:32:47 2001 From: agauld@crosswinds.net (Alan Gauld) Date: Wed, 14 Mar 2001 09:32:47 +0000 Subject: [Edu-sig] Teaching Python instead of Java? Message-ID: <3aaf3bbd.6c36.0@crosswinds.net> >Ah yes Symbolics... It is best to speak politely of the dead :-) There are still afew around! > say: both of these machines implemented a complex > abstraction in microcode. True but the microcode is part of the CPU hardware, you can't change it in any way.(OK pedantically a few experimental chips allow changes to microcode) > The underlying machines that interpreted the microcode > were procedural I disagree. Microcode operates at a level below procedures, it literally just moves data from A to B. The hardware synchronised by the clock operates on one set of bytes at a time, it has no concept of a procedure. If you ignore the microcode then the hardware is purely a bit twiddling function. > Microcode is more correctly called firmware > but so is PCs BIOS. No, there is a huge difference in the nature of microcode and BIOS code. As big a difference as between assembler and Python! Firmware is by definition replaceable, microcode, in general, is not. > There are/were non procedural computers but these > two computers are not in that list. I'll beg to differ, but I doubt the difference if strictly pertinent to this list so I won't argue either :-) Alan G From jeff@elkner.net Wed Mar 14 18:34:24 2001 From: jeff@elkner.net (Jeffrey Elkner) Date: 14 Mar 2001 13:34:24 -0500 Subject: [Edu-sig] Cards n stuff... In-Reply-To: <3.0.3.32.20010313110451.00b3b100@pop3.norton.antivirus> References: <200103131227.HAA30999@cj20424-a.reston1.va.home.com> <200103131216.HAA02030@angelo.arlington.k12.va.us> <200103131227.HAA30999@cj20424-a.reston1.va.home.com> <3.0.3.32.20010313110451.00b3b100@pop3.norton.antivirus> Message-ID: <200103141842.NAA07207@angelo.arlington.k12.va.us> Thanks Kirby! This was really helpful. The one line I would change is: ranks = ['Ace']+map(str,range(2,11))+['Jack','Queen','King'] I haven't discussed map at all yet, and actually don't plan to. In using Python to teach, simplicity takes on even more importance than it usually has (and it is always important ;-) Python is such a wonderful language for teaching precisely because it "fits your brain". In the case of students new to computing, "fitting their brains" means minimizing the number of previous concepts needed to understand a new concept. In truth, what is good for new learners is good in general, only more so. Thanks again for your help! jeff On 13 Mar 2001 11:04:51 -0800, Kirby Urner wrote: > > Hi Jeff -- > > Here's a slightly modified version of your code, including > some ideas about shuffling: > > import random > > class Card: > > def __init__(self, suite, rank): > self.suite = suite > self.rank = rank > > def __repr__(self): > return self.rank + ' of ' + self.suite > > class Deck: > > suites = ['Hearts','Diamonds','Spades','Clubs'] > ranks = ['Ace']+map(str,range(2,11))+['Jack','Queen','King'] > > def __init__(self): > self.cards = [] > for suite in Deck.suites: > for rank in Deck.ranks: > newCard = Card(suite, rank) > self.cards.append(newCard) > > def shuffle(self): > newdeck = [] > while len(newdeck)<52: > randomcard = random.choice(self.cards) > newdeck.append(randomcard) > self.cards.remove(randomcard) > self.cards = newdeck > > > > Note: I manually truncated/edited the list of cards to save > space. > > >>> mydeck = cards.Deck() > >>> mydeck.cards > [Ace of Hearts, 2 of Hearts, 3 of Hearts, 4 of Hearts, 5 of Hearts, > 6 of Hearts, 7 of Hearts, 8 of Hearts, 9 of Hearts, 10 of Hearts, > Jack of Hearts, Queen of Hearts, King of Hearts, Ace of Diamonds...] > > >>> mydeck.shuffle() > >>> mydeck.cards > [Ace of Spades, 9 of Hearts, 7 of Spades, Queen of Diamonds, 3 of Hearts, > Jack of Spades, 10 of Clubs, 4 of Spades, 10 of Hearts, Queen of Spades, > 7 of Diamonds, Ace of Hearts, Queen of Hearts, Queen of Clubs, 6 of Spades, > King of Hearts...] > >>> len(mydeck.cards) > 52 From pdx4d@teleport.com Wed Mar 14 18:32:27 2001 From: pdx4d@teleport.com (Kirby Urner) Date: Wed, 14 Mar 2001 10:32:27 -0800 Subject: [Edu-sig] Cards n stuff... In-Reply-To: <3.0.3.32.20010313172424.0095bd20@pop3.norton.antivirus> References: <3.0.3.32.20010313121025.00b3b100@pop3.norton.antivirus> <3.0.3.32.20010313110451.00b3b100@pop3.norton.antivirus> <200103131706.MAA11809@angelo.arlington.k12.va.us> <200103131227.HAA30999@cj20424-a.reston1.va.home.com> <200103131216.HAA02030@angelo.arlington.k12.va.us> <200103131227.HAA30999@cj20424-a.reston1.va.home.com> Message-ID: <3.0.3.32.20010314103227.00964ce0@pop3.norton.antivirus> I thought I was done with this Cards thread (fun fun), but was just reading the Python docs and discovered the 'shuffle' method in the random module. It reorders a sequence in place. That reduces my shuffle method to: def shuffle(self): shuffle(self.cards) -- with an 'from random import shuffle' up top. Also, whereas the loop-in-a-loop (I call 'em loop-dee-loops) method for initializing every combination of suite and rank is fine, there's a way to do this with 2.0+ list comprehension which deserves advertising, so I've changed Deck's __init__ to: def __init__(self): self.cards = [Card(s,r) for s in suites for r in ranks.keys()] self.shuffle() One might argue that we could take out 'def shuffle' as a method altogether, and just get a new deck every time we want a shuffled deck. But there's always a chance we'll want to deal some cards and then shuffle the remaining cards in the deck (?), which is what the separate 'shuffle' method will do for us. Latest version: http://www.inetarena.com/~pdx4d/ocn/python/cards.py Kirby PS: I realize my otherplayer's decision-making is pretty lame. otherplayer gets to see what two cards I'm dealt yes? So that should factor into the decision whether to ask for a 3rd card (it doesn't). Like I said, my understanding of Blackjack is rather weak, and this cards.py module is more a 'scratch pad' of ideas -- it's not a mature implementation of the game, by any stretch of the imagination. Thanks again to Jeff for getting my wheels spinning. I think using objects for Deck, Card and Hand (player) is a good illustration of OO structuring (even though no subclasses get used), plus having parts of the code in a more procedural mode, while making use of these objects, shows how Python allows a creative blending/hybrid of an OO-style with procedural and functional styles -- part of what makes it both fun and powerful. From pdx4d@teleport.com Wed Mar 14 19:34:56 2001 From: pdx4d@teleport.com (Kirby Urner) Date: Wed, 14 Mar 2001 11:34:56 -0800 Subject: [Edu-sig] Cards n stuff... In-Reply-To: <200103141842.NAA07207@angelo.arlington.k12.va.us> References: <3.0.3.32.20010313110451.00b3b100@pop3.norton.antivirus> <200103131227.HAA30999@cj20424-a.reston1.va.home.com> <200103131216.HAA02030@angelo.arlington.k12.va.us> <200103131227.HAA30999@cj20424-a.reston1.va.home.com> <3.0.3.32.20010313110451.00b3b100@pop3.norton.antivirus> Message-ID: <3.0.3.32.20010314113456.00a74100@pop3.norton.antivirus> At 01:34 PM 03/14/2001 -0500, you wrote: >Thanks Kirby! > >This was really helpful. The one line I would change is: > > ranks = ['Ace']+map(str,range(2,11))+['Jack','Queen','King'] You could go: ranks = ['Ace'] + [str(x) for x in range(2,11)] + ['Jack','Queen','King'] >I haven't discussed map at all yet, and actually don't plan to. > I think because of list comprehension syntax (as above), 'map' and 'little lambda' are even less necessary than before. I really like the power of list comprehension, and think it makes sense to teach it e.g.: >>> def f(x): return x*x >>> [f(x) for x in range(5)] # successive 2nd powers [0, 1, 4, 9, 16] and >>> [f(x) for x in range(5) if x%2==0] # even 2nd powers only [0, 4, 16] In a 'math through programming' context, it'll be combined with 'zip' to create coordinate pairs, e.g.: >>> zip(range(5),[f(x) for x in range(5)]) [(0, 0), (1, 1), (2, 4), (3, 9), (4, 16)] This starts to become graphable, with appropriate methods in the background. >In using Python to teach, simplicity takes on even more importance >than it usually has (and it is always important ;-) > Yes, I understand. Usually you'll have a few students who want to tackle some of the more 'advanced' syntax, so having exercises set aside for them makes some sense too. >Python is such a wonderful language for teaching precisely >because it "fits your brain". In the case of students new >to computing, "fitting their brains" means minimizing the number of >previous concepts needed to understand a new concept. > Yes. Also, though, it's great to start with kids without a lot of preconceptions. They can start fresh, taking OO concepts for granted (no paradigm shift required). For example, the idea that 'map' distributes a function across a sequence of inputs sort of fits our mental picture of a conveyor belt, with someone squeezing frosting on each cupcake as it goes by, or whatever it is: >>> def add_frosting(thing): return thing + " with frosting" >>> map(add_frosting, ['cupcake']*5) ['cupcake with frosting', 'cupcake with frosting', 'cupcake with frosting', 'cupcake with frosting', 'cupcake with frosting'] Once you've got some hooks to visuals or well-known models, then these 'fancy' Pythonic expressions take on a more mundane appearance. map(str,range(10)) simply 'waves the magic wand' over a list 0...9, where the 'wand', in this case, isn't add_frosting, but the 'convert to string' function str(). I know you know this -- just trying to imagine how I'd explain it to someone with no clue. >In truth, what is good for new learners is good in general, >only more so. > >Thanks again for your help! > >jeff I've sent you a number more since then. You probably won't want to use stuff like: ranks = eval( '{' + ','.join(["'%s':%s" % x for x in zip(['Ace'] + [str(x) for x in range(2,11)] + ['Jack','Queen','King'], range(1,15))]) + '}' ) But if your class is up for such a dictionary (using 'spelled out' rank to look up corresponding integer value), a more loopy initialization would be: def mkrankdict(): j = 1 dict = {} for i in ['Ace','2','3','4','5','6','7','8','9','10', 'Jack','Queen','King']: dict[i]=j j = j+1 return dict ranks = mkrankdict() >>> ranks = mkranddict() >>> ranks {'8': 8, '9': 9, '6': 6, '7': 7, 'Jack': 11, '5': 5, '2': 2, '3': 3, 'Queen': 12, 'King': 13, 'Ace': 1, '4': 4, '10': 10} That'll be easier to read for a lot of us. It'd be fun to show these side-by-side, as two ways of getting the same result. Kirby From jeff@elkner.net Thu Mar 15 13:28:29 2001 From: jeff@elkner.net (Jeffrey Elkner) Date: 15 Mar 2001 08:28:29 -0500 Subject: [Edu-sig] Re: Python for fun and OBP In-Reply-To: Message-ID: <200103151336.IAA20100@angelo.arlington.k12.va.us> Hi Chris! Let me introduce you to two of my students, Anoush Garakani and Scott Newman. They are both students in my CSC I and II class who have signed up for AP CSC next year. I've asked them to look at the Towers of Hanoi lesson and give us feed back. These kinds of lessons will be very useful to our CS program. I have been grappling for a long time on how to leverage Python to improve understanding in our AP course. I have not yet effectively done that. Next year I plan on using both languages in the course. Concepts will be introduced first using Python and then we will focus on the question, now how do you do this in C++? C++ syntax is so ill-suited to the task of teaching programming and slows down the pace of the course to such a degree that we always end up rushing at the end of the year to get to the topics that are really supposed to be the core of the course: data structures (lists, stacks, queues, trees, heaps), and algorithms (searching and sorting). These topics are well covered in the Java version of "How to think like a computer scientist", so I plan on translating the rest of that book into Python as soon as I can. If we can create a web site with both a text book and collection of activities and case studies, we will have a real resource for anyone interested in using Python to teach programming. Thanks for the lesson! jeff On 12 Mar 2001 12:58:08 -0800, Chris Meyers wrote: > Hi Jeff, > > Did the tower.py and tower.doc attachments come through? I'm > anxious to hear your impressions. > > Thanks, Chris From hei@adtranzsig.de Thu Mar 15 13:57:23 2001 From: hei@adtranzsig.de (Dirk-Ulrich Heise) Date: Thu, 15 Mar 2001 14:57:23 +0100 Subject: [Edu-sig] Teaching Python instead of Java? References: <3aaf3bbd.6c36.0@crosswinds.net> Message-ID: <010501c0ad57$dcc51f40$13ec1fc2@adtranzsig.de> -----Ursprüngliche Nachricht----- Von: "Alan Gauld" An: "Morris, Steve" ; ; "Tom Malcolmson" ; Gesendet: Mittwoch, 14. März 2001 10:32 Betreff: RE: [Edu-sig] Teaching Python instead of Java? [...] > > say: both of these machines implemented a complex > > abstraction in microcode. > > True but the microcode is part of the CPU hardware, > you can't change it in any way.(OK pedantically a > few experimental chips allow changes to microcode) Surprise, it's already part of your favorite mainstream CPU. Pentia allow it. BIOS Roms today contain microcode blocks that are loaded into the CPU depending on its exact mask number, to fix processor bugs. So with a little hacking, you might roll your own symbolics processor du jour. Dirk Heise dheise at debitel dot net From Arthinator@aol.com Thu Mar 15 13:57:12 2001 From: Arthinator@aol.com (Arthinator@aol.com) Date: Thu, 15 Mar 2001 08:57:12 EST Subject: [Edu-sig] Raytressi - another few words Message-ID: Raytressi - the open source Python scripted raytracer I had posted up about: The distribution includes Python 1.5.2/Tk8.0, with, of couse, the Raytressi C++ compiled against it. Took Guido's advice re: the Lightflow thread - compiled the C++ under Windows against Python2.0. All is well, so that I now have a Python2.0 scriptable raytracer in a single .dll. Pleasing. Agree with Mark that the Pov-ray export utility for VPython works great, but since the raytracing I would be doing is fairly basic, and Raytressi looks quite competent - and can be part of a compact , self-contained Python-centric graphics exploration environment with VPython or PyOpenGL the dynamic/real-time piece... Have not yet responded to Guido's request for a edu-sig blurb on Raytressi - assume no one else has. Confronting French language and French educational system ignorance. But will follow-up once I get a little more familiar with Raytressi functionality, with something general enough to avoid the possiblitiy of having edu-sig page stating something inaccurately. ART From Arthur_Siegel@rsmi.com Thu Mar 15 17:59:51 2001 From: Arthur_Siegel@rsmi.com (Arthur_Siegel@rsmi.com) Date: Thu, 15 Mar 2001 11:59:51 -0600 Subject: [Edu-sig] Blender note Message-ID: <00580612.N22121@rsmi.com> * Release of Blender 2.12. With 10 man-years of development added to Blender 2.0, we are excited to announce the latest release of Blender, including many new game engine, modeling and Python features! As a community member, you can download it March 16th, a few days before the official release at the Game Developers Conference (GDC). - http://www.blender.nl/showitem.php?id=160&page=1#release Powerful stuff, with a large and growing following - of mostly young hacker types, it seems. . Doing much with it is not on my own schedule, though. ART From pdx4d@teleport.com Fri Mar 16 06:39:22 2001 From: pdx4d@teleport.com (Kirby Urner) Date: Thu, 15 Mar 2001 22:39:22 -0800 Subject: [Edu-sig] Cryptonomicon (group theory for youngsters) In-Reply-To: <00580612.N22121@rsmi.com> Message-ID: <3.0.3.32.20010315223922.00b5d900@pop3.norton.antivirus> Some of the recent tricks with Cards (as in deck of) fed my renewed look at ciphers and cryptology, as a good segue to/from group theory, with Python providing the playground equipment and other fun apparatus. Like, in earlier posts I'd been randomly choosing letters to pair with other letters (to set up a 'clubhouse code' or simple letter substitution cipher), but now I've learned about the 'shuffle' method in SLM (Standard Library Module) random.py -- so the code gets simpler still: _domain = list(uppercase) def mkcode(): """ Uniquely pair each element in _domain with another """ uc = _domain+[] shuffle(uc) dict ={} for i,j in zip(_domain,uc): dict[i]=j return dict _domain+[] is another way of making sure we assign uc a *copy* of _domain, and not a pointer to the same memory object. Then we shuffle the copy, create a blank dictionary, and fill it with unshuffled->shuffled pairs, e.g. A->C, B->Q and so on. Usage: >>> mycode = ciphers.mkcode() >>> mycode {'Z': 'L', 'X': 'J', 'Y': 'S', 'V': 'U', 'W': 'H', 'T': 'Q', ... etc.} So what's with _domain? Well, I might want to use integers instead of letters, which isn't as nice for letter substitution, but is what the group theory people use when presenting a permutation (same as a substitution dictionary). Alternative usage: >>> ciphers._domain = range(1,11) >>> mycode = ciphers.mkcode() >>> mycode {10: 3, 9: 10, 8: 9, 7: 6, 6: 2, 5: 8, 4: 4, 3: 1, 2: 7, 1: 5} New the group theory folks have an alternative notation for such as the above. Pick a number, any number, then worm your way through the dictionary, chaining each item to the one in points to, e.g. 10->3->1->5->8->9->10. Then organize this into a tuple: (10,3,1,5,8,9), with the understanding that each member is followed by its pair, with the last wrapping around to the first. But notice: we didn't get them all. 6->2->7->6 is another cycle, with no members in common with the first (i.e. they're 'disjoint'). So it's a fun exercise in Python to write a routine that takes a dictionary of unshuffled,shuffled pairs, as up top, and converts same to a list of cyclic tuples, as per this example. Usage: >>> ciphers.mkcycles(mycode) [(10, 3, 1, 5, 8, 9), (7, 6, 2)] Yep (doesn't matter that here it's (7,6,2) instead of (6,2,7) -- same info). And you'd want to make it bidirectional: >>> p = ciphers.mkcycles(mycode) >>> ciphers.mkdict(p) {10: 3, 9: 10, 8: 9, 7: 6, 6: 2, 5: 8, 4: 4, 3: 1, 2: 7, 1: 5} The thing to realize is that when a code pairs a letter with itself (or number with itself), you simply don't mention it in the cycles notation. Like, if it's the 'identity dictionary' (*every* letter is paired with itself), then the list of corresponding cyclic tuples is empty, and vice versa: >>> ciphers.mkcycles({1:1,2:2,3:3,4:4}) [ ] >>> ciphers._domain = list(ciphers.uppercase) >>> ciphers.mkdict([]) {'Z': 'Z', 'X': 'X', 'Y': 'Y', 'V': 'V', 'W': 'W', 'T': 'T' ... etc.} Back to cryptology: if we use simple letter substitution, with the same new letter always taking the place of the same old letter, then certain patterns will clue the would-be code cracker. Palindromes, which spell out the same sentence forward and backward, will still be palindromes, even if nonsensical. Consider the 'encrypt' method: it simply takes one of these substition dictionaries (a.k.a. permutations) and does the swap, ignoring any characters/punctuation/other symbols that aren't being converted: def encrypt(plaintext,secretkey): """ substitute shuffled elements as per secretkey, or leave as is if not in the key -- designed to work with _domain = list(uppercase) """ ciphertext = "" keys = secretkey.keys() for i in plaintext.upper(): if not i in keys: ciphertext += i else: ciphertext += secretkey[i] return ciphertext So you can go: >>> mycode = ciphers.mkcode() # make a random permutation >>> ciphers.mkcycles(mycode) # view permutation as list of cycles [('Z', 'R', 'H', 'A', 'L', 'X', 'N', 'M', 'Y', 'F', 'C', 'J', 'T', 'U', 'G', 'P', 'I', 'Q', 'O', 'B', 'V', 'W', 'E'), ('S', 'D', 'K')] >>> encrypted = ciphers.encrypt("Able was I ere I saw Elba",mycode) >>> encrypted 'LVXZ ELD Q ZHZ Q DLE ZXVL' >>> decrypted = ciphers.decrypt(encrypted,mycode) >>> decrypted 'ABLE WAS I ERE I SAW ELBA' Notice that the encrypted palindrome is still a palindrome. That makes is a lot easier to crack. Back to group theory: we can multiply permutations together, meaning if you scramble a scramble, you get another scramble. For example if p1 is [('A','C','D')] and p2 is [('A','D','C')] then p1*p2 means we apply p1 to p2 i.e. A->D->A, so A->A, and D->C->D so D->D, and yes, C->C. p1 and p2 are inverses of one another, since their product is the identity permutation (that's the definition of inverse pairs -- their product is the identity e, where p1*e = e*p1 = p1). So it makes sense to design a Python class that makes these permutations into objects, which we can then multiply together using an overridden * symbol (we'll define both __mul__ and __pow__ -- the latter because a permutation can also permute itself, as many times as we like). Here's what this looks like: >>> ciphers._domain = ['A','D','C'] # a restricted domain >>> dict1 = ciphers.mkdict(['A','C','D']) >>> dict2 = ciphers.mkdict(['A','D','C']) >>> dict1 {'C': 'C', 'D': 'D', 'A': 'A'} >>> dict2 {'C': 'C', 'D': 'D', 'A': 'A'} >>> dict1 = ciphers.mkdict([('A','C','D')]) >>> dict1 {'C': 'D', 'D': 'A', 'A': 'C'} >>> dict2 = ciphers.mkdict([('A','D','C')]) >>> dict2 {'C': 'A', 'D': 'C', 'A': 'D'} >>> p1 = ciphers.P(dict1) # create permutation objects... >>> p2 = ciphers.P(dict2) # using code dictionaries >>> p1*p2 Permutation: [] Note: Permutation: [] is the empty list, i.e. the identity permutation -- the expected result. This idea of multiplying permutations, raising them to powers and taking their inverses suggests we might create a more elaborate enciphering strategy wherein the permutations multiply to give new dictionaries with each letter to be enciphered -- a reversible process (one would hope). [ to be continued ] Kirby From pdx4d@teleport.com Sat Mar 17 19:06:44 2001 From: pdx4d@teleport.com (Kirby Urner) Date: Sat, 17 Mar 2001 11:06:44 -0800 Subject: [Edu-sig] Cryptonomicon (group theory for youngsters) #2 In-Reply-To: <3.0.3.32.20010315223922.00b5d900@pop3.norton.antivirus> References: <00580612.N22121@rsmi.com> Message-ID: <3.0.3.32.20010317110644.0344bd30@pop3.norton.antivirus> For a set of elements to comprise a group vis-a-vis some definition of the binary operator * (multiplication), they need to combine (multiply) associatively, but not necessarily commutatively. If * turns out to be commutative, the group is said to be Abelian. The complete set of properties you need to be a group are: * Closure: the product of two elements in the set is always itself in the set * Associativity: p1*p2*p3 has an unambiguous meaning i.e. (p1*p2)*p3 and p1*(p2*p3) give the same result * Inverse: every element has an inverse such that the product of the two is the identity element * Neutral: some element e, called the identity element, has a "neutral effect" when multiplying other elements i.e. p*e=e*p=p. These four properties spell CAIN, an easy mnemonic, especially in light of Abelian groups, named for the mathematician Niels Henrik Abel (1802-29), but also the name of Cain's brother in the Genesis story. You'll see below that our domain of alphabet or integer permutations under multiplication is a non-Abelian group, i.e. * is a non- commutative, but associative operation. But first, we need some permutation objects to play with. Let's start with some simple integer-based ones. >>> from ciphers import * # asterisk means "all" here >>> ciphers._domain = range(1,11) >>> p1=P() >>> p2=P() >>> p1 Permutation: [(8, 5, 2, 6, 7, 4, 1)] >>> p2 Permutation: [(10, 7, 6, 8, 2, 5, 1), (9, 4, 3)] When objects of class P are initialized with no arguments, we simply invoke mkcode() to shuffle the domain and create a substition dictionary of unshuffled:shuffled key:value pairs: class P: """ Permutations: these objects multiply with each other, return an inverse, may be raised to an integer power """ def __init__(self,dict=None): if dict==None: self.dict = mkcode() else: self.dict = dict Multiplication is defined as follows: class P: ... def __mul__(self,other): newdict = {} for i in other.dict.keys(): newdict[i] = self.dict[other.dict[i]] return P(newdict) Now we're ready to demonstrate non-commutativity: >>> p1*p2 Permutation: [(10, 4, 3, 9, 1), (8, 6, 5)] >>> p2*p1 Permutation: [(10, 7, 3, 9, 4), (8, 1, 2)] Remember, these cyclic expressions are another way of presenting the same info as held by a substitution dictionary. In the previous post, the mkcycles(dict) method was introduced, for going from a dictionary to a list of tuples. This method is built in to the P class, as it's method for self-representation: class P: ... def __repr__(self): return "Permutation: " + str(mkcycles(self.dict)) p1*p2 applies p1 to p2, so after 10->7, we take 7->4, so in the product, 10->4. Demonstrating associativity: >>> p3 Permutation: [(9, 6, 7), (8, 5), (4, 2, 1, 3)] >>> p1*(p2*p3) Permutation: [(10, 4, 2), (9, 5, 6, 7, 1)] >>> (p1*p2)*p3 Permutation: [(10, 4, 2), (9, 5, 6, 7, 1)] Or we could have done: >>> p1*p2==p2*p1 0 >>> p1*(p2*p3)==(p1*p2)*p3 1 The method for determining equality simply compares the internal dictionary of two objects: class P: ... def __eq__(self,other): return self.dict==other.dict Note: some specific p1,p2 may commute, e.g. if p1 and p2 are inverses -- it's just that they need not. The operation * is not in general a commutative operation in this realm of permutations. Using a P-class dictionary, we can encipher a message. Let's make p1 the result of 4 random permutations, intermultiplied (itself a permutation -- by virtue of Closure): >>> ciphers._domain = list(uppercase) >>> p1 = P()*P()*P()*P() >>> p1 Permutation: [('Z', 'K', 'C', 'N', 'U', 'M', 'B', 'Y', 'H', 'R', 'I', 'P', 'E', 'L', 'W', 'O', 'D', 'Q', 'T', 'J', 'X', 'G', 'F', 'S'), ('V', 'A')] Let's make p2 be the inverse of p1 (every p has an inverse), i.e. its internal dictionary is a reverse version of p1's: >>> p2 = p1.inv() >>> p2 Permutation: [('Z', 'S', 'F', 'G', 'X', 'J', 'T', 'Q', 'D', 'O', 'W', 'L', 'E', 'P', 'I', 'R', 'H', 'Y', 'B', 'M', 'U', 'N', 'C', 'K'), ('V', 'A')] We see that to decrypt is to reverse the process of encryption, which in this case means encrypting the ciphertext with the reversed dictionary, to get the plaintext back out (except converted to uppercase as a side-effect): >>> encrypt("Able was I ere I saw Elba",p1.dict) 'VYWL OVZ P LIL P ZVO LWYV' >>> encrypt("VYWL OVZ P LIL P ZVO LWYV",p2.dict) 'ABLE WAS I ERE I SAW ELBA' When we multiply a permutation by itself, that's like raising a number to a power, e.g. p1*p1 may be written as p1**2 (** is Python's exponentiation syntax) or, alternatively, as pow(p1,2). Likewise, p1.inv() may be expressed as p1**(-1) or pow(p1,-1), since p1*p1.inv() = [] or the identity element. Raising p1 to the -3 power is equivalent to raising it to the 3rd power and then taking the inverse of the result, i.e. pow(p1,-3) = (p1*p1*p1).inv(): >>> pow(p1,-3) Permutation: [('Z', 'G', 'T', 'O', 'E', 'R', 'B', 'N'), ('X', 'Q', 'W', 'P', 'H', 'M', 'C', 'S'), ('Y', 'U', 'K', 'F', 'J', 'D', 'L', 'I'), ('V', 'A')] >>> (p1*p1*p1).inv() Permutation: [('Z', 'G', 'T', 'O', 'E', 'R', 'B', 'N'), ('X', 'Q', 'W', 'P', 'H', 'M', 'C', 'S'), ('Y', 'U', 'K', 'F', 'J', 'D', 'L', 'I'), ('V', 'A')] The internal P-class __pow__ method simply invokes the already-define __mul__ repeatedly, inverting as necessary (i.e. if the exponent is a negative number). Also p1**0 is defined to be the identity element, whereas p1**1 is just p1 itself -- definition analogous to the behavior of * when used for the "regular" multiplication of integers or reals. class P: ''' def __pow__(self,n): new = P(mkdict([])) if n==0: return new for i in range(abs(n)): new = self * new if n<0: new = new.inv() return new When a permutation permutes itself, as in p1*p1, the tuple elements skip ahead one notch, to pair with elements that had been 2 ahead: >>> p1 Permutation: [('Z', 'K', 'C', 'N', 'U', 'M', 'B', 'Y', 'H', 'R', 'I', 'P', 'E', 'L', 'W', 'O', 'D', 'Q', 'T', 'J', 'X', 'G', 'F', 'S'), ('V', 'A')] >>> p1**2 Permutation: [('Z', 'C', 'U', 'B', 'H', 'I', 'E', 'W', 'D', 'T', 'X', 'F'), ('Y', 'R', 'P', 'L', 'O', 'Q', 'J', 'G', 'S', 'K', 'N', 'M')] Whereas in p1, Z->K, in p1**2, Z->C, which was 2 ahead in p1. What this suggests is that any given tuple will eventually point all the way around the cycle back to the start, such that Z->Z, K->K and so on. But because the different tuples may have different lengths, they may not all reach this "identity position" at the same power. But is their some power where all the tuples are _guarenteed_ to become the identity mapping, all at the same time? Yes! That would be the lowest common multiple of the lengths of all the tuples. With p1 above, the tuples have lengths 24, and 2. The lcm is 24, so p1**24 should be the identity element... >>> p1**24 Permutation: [] Let's try another one: >>> newp = P() >>> newp Permutation: [('Z', 'E', 'G', 'N', 'W', 'Y', 'J', 'Q', 'X', 'F', 'M', 'L', 'T', 'A', 'K', 'H'), ('V', 'B', 'D', 'P', 'R', 'C', 'O', 'U', 'S')] >>> map(len,mkcycles(newp.dict)) [16, 9] >>> lcm(16,9) 144 >>> pow(newp,144) Permutation: [] The power to which you need to raise permutation p to get the identity element is what we call the 'order of p'. We can build this into the P class as another method, ord(): class P: ... def ord(self): """ returns the exponent n of p such that p**n = [] (identity element) """ return reduce(lcm, map(len, mkcycles(self.dict))) Usage: >>> newp.ord() 144 Given this definition, pow(p1,p1.ord()) should always return the identity permutation, which we may initialize with the identity dictioinary: >>> ident = P(mkdict([])) >>> anyp = P() >>> pow(anyp,anyp.ord())==ident 1 Once anyp reaches the identity state, the next multiplication will get us back to the original anyp, and the cycle begins again, i.e. pow(anyp,1), pow(anyp,2)... pow(anyp,anyp.ord()) is a complete cycle of unique permutations based on a base of anyp. Our strategy for building a more sophisticated enciphering engine will be to have a set of permutations, which we will call "rotors", organized "odometer fashion" such that when the first powers itself around a complete cycle, it'll kick the second to the next power, and the second, when "once around the clock" will kick the third and so on. This is like having a mixed-base number (presuming the rotors have different orders, different periods), and counting up from 0 in that system. If the order of the first rotor is 7, then we would go 001, 002 ... 006, 010 -- p1 becomes the identity permutation just as p2 kicks up to its first power. The engine will run the counter up one click for each letter that gets enciphered, so the substitution dictionary will be constantly changing. This will remove the property of always having the same letter stand for some other letter. And, to make things even more difficult, we'll throw in the space character as one more "letter" to be enciphered, thereby obscuring word boundaries. Because this enciphering strategy is somewhat akin to that used during WWII by a number of encyption machines, including the famous Enigma, I'll call this my Enigma class. >>> ciphers._domain = ciphers._domain + [' '] # add space to domain >>> enigma = Enigma([P(),P(),P()]) # use 3 random rotors >>> enigma.counter.bases # the orders of these rotors [50, 84, 18] >>> enigma.encrypt("Able was I ere I saw Elba") 'BFTMSWZZF ESKBMAKXDVSYTJJ' >>> enigma.reset() # return counter to [0,0,0], self.dict to [] >>> enigma.decrypt("BFTMSWZZF ESKBMAKXDVSYTJJ") 'ABLE WAS I ERE I SAW ELBA' Notice the ciphertext is no longer palindromic -- isn't the same forwards and backwards, unlike the original. Plus word spacing has been effectively masked. Suddenly, our code is much harder to crack. The decryption method simply runs the rotors in reverse, and associatively "undoes" whatever was done by the encryption method, returning our ciphertext back to the plaintext original (except for the upper-casing side effect). [ to be continued ] From Arthinator@aol.com Sun Mar 18 14:50:18 2001 From: Arthinator@aol.com (Arthinator@aol.com) Date: Sun, 18 Mar 2001 09:50:18 EST Subject: [Edu-sig] The Educational Robotics Platform Message-ID: <70.8bd8bbf.27e6252a@aol.com> Python-centric educational robotics, in process http://eggo.sourceforge.net/ Aimed at middle school. Site has a lot of documentation on the project's intentions. Quite interesting. ART From Jonathan Pennington Sun Mar 18 22:09:50 2001 From: Jonathan Pennington (Jonathan Pennington) Date: Sun, 18 Mar 2001 17:09:50 -0500 Subject: [Edu-sig] The Educational Robotics Platform In-Reply-To: <70.8bd8bbf.27e6252a@aol.com>; from Arthinator@aol.com on Sun, Mar 18, 2001 at 09:50:18AM -0500 References: <70.8bd8bbf.27e6252a@aol.com> Message-ID: <20010318170950.A8312@coastalgeology.org> * Arthinator@aol.com [010318 10:16]: > Python-centric educational robotics, in process > http://eggo.sourceforge.net/ > Aimed at middle school. Site has a lot > of documentation on the project's intentions. > Quite interesting. Thank you! That's quite a complement coming from this list! And, of course, questions (and more importantly: suggestions) can be made to me directly. I'm hoping to get a beta version by summer's end. Including the code and documentation on controlling a number of servo & motor controllers, sensors and other outputs. After the beta and standard docs will be a lab-based manual. The EGg0 (that's a zero) system as a whole is currently being developed around a PC/104 board, but all software development is on my Linux system with communication through a serial port and is being "ported" to the embedded platform. Primary consideration is the use of the software for all on desktop systems. I am developing an entire platform with computer and controllers, however, so that it can be used at all levels of education from K-12 (with the software and maybe Lego sets) through college and into industry (with the full PC/104 board, GPL'd Real Time OS, and system software). The hard part is developing it so that the good people on this list and beyond will still find the software useful, even if they can't/don't get all of the hardware. GPL'd source is no good if I only program it for certain hardware. I'm trying to hit every major servo controller and DC motor controller used in hobby robotics (Honestly, not as hard as I'd thought, since similarities abound). The software is a package of modules, with a seperate module for each discrete controller, and a (hard|medium|easy) way to use them, so that all levels of programming can be taught. I'll also be working up (relatively) inexpensive circuits and selling kits (near cost) as well as posting the full parts lists and schematics/diagrams. Hopefully, I can get cost down so that it's available to all. Goal is that at the low end someone can spend $20 or less on supplies from Rat Shack, stick them all into a bread board, connect them to a serial port, and control a couple servos while learning to program with the software. At the high end, use the complete platform and software suite (maybe the graphical Control Station) to allow non-programmers to control an industrial robot. Always with an emphasis on the educatioal aspects. Wish me luck. -J -- Jonathan Pennington | john@coastalgeology.org "A computer without windows is like a dog without bricks tied to its head." From Arthinator@aol.com Mon Mar 19 06:03:21 2001 From: Arthinator@aol.com (Arthinator@aol.com) Date: Mon, 19 Mar 2001 01:03:21 EST Subject: [Edu-sig] The Educational Robotics Platform Message-ID: >At the high end, use the complete platform and software suite (maybe the >graphical Control Station) to allow non-programmers to control an industrial >robot. >Always with an emphasis on the educatioal aspects. Wish me luck. You have a market anxiously waiting. From a survey of one - my son - the BattleBots show - Comedy Central cable network of all things - has piqued kids interest in robotics. But let the non-programmers wait - assuming by non-programmers you mean those who aren't willing to take on Python. Damn the GUIissies. Get around to them when you can. ART From hei@adtranzsig.de Mon Mar 19 07:15:09 2001 From: hei@adtranzsig.de (Dirk-Ulrich Heise) Date: Mon, 19 Mar 2001 08:15:09 +0100 Subject: [Edu-sig] The Educational Robotics Platform References: <70.8bd8bbf.27e6252a@aol.com> <20010318170950.A8312@coastalgeology.org> Message-ID: <006d01c0b044$5528b610$13ec1fc2@adtranzsig.de> On the site, you explain that the Lego Mindstorms software is too abstract for real programming. That's right. But it should be noted that there are free software alternatives, like a Forth: http://www.hempeldesigngroup.com/lego/pbFORTH/ for those that want to continue programming the RCX. A Python interpreter probably wouldn't fit into the 32K of the RCX. RCX-Forth is in use by a german teacher to teach programming: http://www.forth-ev.de/rcx-webs/index.htm It's a german site, use Babelfish if needed. He used the Forth because his PC equipment (386's) in school simply was too old to run the resource-hungry Lego software. Of course, using a PC104 gives you a lot more memory, but i have some concerns: - PC104 are much more expensive than MPUs - You'll need a lot of battery power If you can tell me where to find a PC104 for 100$, the first concern would be gone. You are mentioning http://www.tri-m.com/ as a low-cost resource for PC104 modules; what do they charge for a module? Dirk Heise What's a life and where do i get one? From smorris@cereva.com Mon Mar 19 13:18:57 2001 From: smorris@cereva.com (Morris, Steve) Date: Mon, 19 Mar 2001 08:18:57 -0500 Subject: [Edu-sig] The Educational Robotics Platform Message-ID: <8010912471E0D41189930090278D4E480FF33F@SPAWN> Is a PC/104 based solution really any cheaper than the handy board and similar platforms? It isn't intuitive to me that there should be a cost benefit. The 68hc11 is a much more integrated solution (lots of I/O on the micro) than the x86 family (used by PC/104) which is really aimed at workstations. It seems to me that the strength of PC/104 is availability of software (for example Python) because it is xx86 based. It is not clear to me that it would end up cheaper, in fact the opposite seems more likely. Personally I would love to see a Python based robotics platform but I can afford a more expensive platform. Are you considering embedded Linux? Seems like an obvious strategy. > -----Original Message----- > From: Jonathan Pennington [mailto:john@coastalgeology.org] > Sent: Sunday, March 18, 2001 5:10 PM > To: edu-sig@python.org > Subject: Re: [Edu-sig] The Educational Robotics Platform > > > > * Arthinator@aol.com [010318 10:16]: > > Python-centric educational robotics, in process > > http://eggo.sourceforge.net/ > > Aimed at middle school. Site has a lot > > of documentation on the project's intentions. > > Quite interesting. > > Thank you! That's quite a complement coming from this list! > > And, of course, questions (and more importantly: suggestions) can be > made to me directly. I'm hoping to get a beta version by summer's > end. Including the code and documentation on controlling a number of > servo & motor controllers, sensors and other outputs. After the beta > and standard docs will be a lab-based manual. > > The EGg0 (that's a zero) system as a whole is currently being > developed around a PC/104 board, but all software > development is on my > Linux system with communication through a serial port and is being > "ported" to the embedded platform. Primary consideration is the use > of the software for all on desktop systems. I am developing an > entire platform with computer and controllers, however, so > that it can > be used at all levels of education from K-12 (with the software and > maybe Lego sets) through college and into industry (with the full > PC/104 board, GPL'd Real Time OS, and system software). > > The hard part is developing it so that the good people on this list > and beyond will still find the software useful, even if they > can't/don't get all of the hardware. GPL'd source is no good > if I only > program it for certain hardware. I'm trying to hit every major servo > controller and DC motor controller used in hobby robotics (Honestly, > not as hard as I'd thought, since similarities abound). The software > is a package of modules, with a seperate module for each discrete > controller, and a (hard|medium|easy) way to use them, so that all > levels of programming can be taught. > > I'll also be working up (relatively) inexpensive circuits and selling > kits (near cost) as well as posting the full parts lists and > schematics/diagrams. Hopefully, I can get cost down so that it's > available to all. Goal is that at the low end someone can > spend $20 or > less on supplies from Rat Shack, stick them all into a bread board, > connect them to a serial port, and control a couple servos while > learning to program with the software. At the high end, use the > complete platform and software suite (maybe the graphical Control > Station) to allow non-programmers to control an industrial robot. > > Always with an emphasis on the educatioal aspects. Wish me luck. > > -J > > -- > Jonathan Pennington | john@coastalgeology.org > > "A computer without windows is like a dog > without bricks tied to its head." > > _______________________________________________ > Edu-sig mailing list > Edu-sig@python.org > http://mail.python.org/mailman/listinfo/edu-sig > From Jonathan Pennington Mon Mar 19 23:34:39 2001 From: Jonathan Pennington (Jonathan Pennington) Date: Mon, 19 Mar 2001 18:34:39 -0500 Subject: [Edu-sig] The Educational Robotics Platform In-Reply-To: ; from Arthinator@aol.com on Mon, Mar 19, 2001 at 01:03:21AM -0500 References: Message-ID: <20010319183439.C10091@coastalgeology.org> * Arthinator@aol.com [010319 01:29]: > But let the non-programmers wait - assuming by non-programmers you mean > those who aren't willing to take on Python. Damn the GUIissies. Get around > to them when you can. Embedding Python and building the Python modules are priority one. I have a decent GUI already, but it was primarily developed to help me when I wanted to save time using and programming my own robots for testing (remember the "good" old days when GUIs were time-saving?). With wxPython, it's really incredibly easy to develop a GUI for this software. I basically make a bunch of buttons and sliders that call the same functions I'm using anyway (Took about 2 days to work up the GUI in the screenshot on the website http://eggo.sourceforge.net/screenshot.jpg :-) -J -- Jonathan Pennington | john@coastalgeology.org "A computer without windows is like a dog without bricks tied to its head." From Jonathan Pennington Mon Mar 19 23:44:04 2001 From: Jonathan Pennington (Jonathan Pennington) Date: Mon, 19 Mar 2001 18:44:04 -0500 Subject: [Edu-sig] The Educational Robotics Platform In-Reply-To: <006d01c0b044$5528b610$13ec1fc2@adtranzsig.de>; from hei@adtranzsig.de on Mon, Mar 19, 2001 at 08:15:09AM +0100 References: <70.8bd8bbf.27e6252a@aol.com> <20010318170950.A8312@coastalgeology.org> <006d01c0b044$5528b610$13ec1fc2@adtranzsig.de> Message-ID: <20010319184404.D10091@coastalgeology.org> * Dirk-Ulrich Heise [010319 02:43]: > are free software alternatives, like > a Forth: http://www.hempeldesigngroup.com/lego/pbFORTH/ > for those that want to continue programming > the RCX. I'll be certain to put that on the website! I didn't know about that at all. > Of course, using a PC104 gives you a lot > more memory, but i have some concerns: > - PC104 are much more expensive than MPUs > - You'll need a lot of battery power > If you can tell me where to find a PC104 > for 100$, the first concern would be gone. > You are mentioning http://www.tri-m.com/ > as a low-cost resource for PC104 modules; what > do they charge for a module? Not yet, but they are rapidly coming down. The MZ104 module from Tri-M is $240 in single lots. I'm hoping that they and other smaller (386, etc) systems will continue to fall in price. Until then, there's really not much Pythonistas can do. I'm looking at the rabbit http://www.rabbitsemiconductor.com and similiar uController units, but they will be in addition to, not as opposed to, a PC/104 option. The problem is fitting a Python interpreter in *any* uC system. I'm working on many options though. The whole point is not limiting the idea. If there's enough interest, I'd be more than happy to start a list for this and related discussions (it's bound to get off the edu-sig topic). Just give me the word. The more you all "complain" about the idea and my solutions, the more we broaden the possible offerings of the project. -J -- Jonathan Pennington | john@coastalgeology.org "A computer without windows is like a dog without bricks tied to its head." From fig@monitor.net Tue Mar 20 01:25:16 2001 From: fig@monitor.net (Stephen R. Figgins) Date: Mon, 19 Mar 2001 17:25:16 -0800 Subject: [Edu-sig] The Educational Robotics Platform References: <70.8bd8bbf.27e6252a@aol.com> <20010318170950.A8312@coastalgeology.org> <006d01c0b044$5528b610$13ec1fc2@adtranzsig.de> <20010319184404.D10091@coastalgeology.org> Message-ID: <3AB6B17C.93E5BB11@monitor.net> > The > problem is fitting a Python interpreter in *any* uC system. I'm > working on many options though. The whole point is not limiting the > idea. What about Pippy? http://www.endeavors.com/pippy/ Would that fit on a uC system? I don't know uC constraints, but it seems if they can put a JavaVM on an RCX system (leJos), Python should be able to fit there as well. The whole point of Pippy was to create a Python VM that would work on embedded systems. So why not a a Pippy robot? Stephen From fig@monitor.net Tue Mar 20 17:53:52 2001 From: fig@monitor.net (Stephen R. Figgins) Date: Tue, 20 Mar 2001 09:53:52 -0800 Subject: [Edu-sig] The Educational Robotics Platform References: <8010912471E0D41189930090278D4E480FF361@SPAWN> Message-ID: <3AB79930.C31E0A78@monitor.net> Thanks for the reply, Steve. I wondered about Jython on leJos as well. Think I will ask about it on the Jython list. Let me see if I understand you correctly. JavaVM fits in smaller places than Python because it was written tight from the start. uController's are often very small memory systems, 64k maybe. So you're VM (and with Python we use this term very loosely) has to fit in about 32k or less. Getting down that small is essential if you want to have a robot price-tag of $100 or under - which would be, in your opinion, the threshold to broadly introducing robots in the classroom. Because Python was not written with such small memory environments in mind, it is hard to retrofit it. You end up trying to rewrite the core so you can leave out things. (Pippy for example can get down to about 70k, if you chuck the parser/compiler, floating point, and some other stuff.) You doubt that Python can get down to the 32k requirements to fit it on the cheap uProcessors. Stephen From smorris@cereva.com Tue Mar 20 21:55:50 2001 From: smorris@cereva.com (Morris, Steve) Date: Tue, 20 Mar 2001 16:55:50 -0500 Subject: [Edu-sig] The Educational Robotics Platform Message-ID: <8010912471E0D41189930090278D4E480FF379@SPAWN> > Let me see if I understand you correctly. JavaVM fits in > smaller places > than Python because it was written tight from the start. > uController's > are often very small memory systems, 64k maybe. So you're > VM (and with > Python we use this term very loosely) has to fit in about > 32k or less. > Getting down that small is essential if you want to have a robot > price-tag of $100 or under - which would be, in your opinion, the > threshold to broadly introducing robots in the classroom. I didn't mean anything that specific. Mostly I was just rambling. I do think robotics teaching in the classroom is price sensitive. The lower the price the more it will be used. That doesn't mean there isn't value at other price points. It just means that there will be a lower level of acceptance. Here is a simplified price/performance analysis. I have skipped the lowest price (PIC etc.) solutions. LEGO already owns the middle low end. There is no point in competing there. Here the potential value add is in software. Nobody has got it right yet for this kind of application. Mindstorms graphical interface is a toy and LegOS/pbforth etc are too hard for the entry level user. Python would be ideal however you are unlikely to get Python into 32k of the LEGO bricks. The LEGO brick also suffers badly in communication back to the host which is required for serious development. Hacking the board to replace the unreliable IR with a real serial port would be a "Great Leap Forward" for this platform. The next price point is possibly 16 bit bus micros with a larger address space. Something based on the 68k with 1/2 meg of ram would easily fit Pippy and generally increase usability by an order of magnitude. A total system cost of less than $300 might be possible in this space. The Palm Pilot comes to mind in this category because it is the Pippy target. Its PowerBall micro is 68000 based. A Palm with I/O added (maybe a Handspring type I/O card) would be a powerful low end Robotics controller. It has good development tools (including Pippy) and is low power. The Palm has a Linux port also. The Palm was one of the original targets of embedded Linux. Ideally you want a smaller data bus (lower price) with some kind of extended addressing (beyond 64k) combined with a good C compiler, preferably gcc. (gcc gives you the ability to port things like Pippy.) You also want someone else to make the board in volume so this is a search for, not a make selection process. With your project (PC/104 based) you are talking about the next level which is machines that are 32/64 bit bus with multi megabyte address range but can still run stripped down real time Linux Kernels. This opens development choices substantially. I think it is worthwhile to work on this platform but the end price for hardware, motors and sensors will likely be in the $500-$700 price range which will restrict its target audience. This is the Cadillac of low end robotics machines but will definitely be the winner as prices come down. Working in this space you would have to be happy with lower initial acceptance. I like RTLinux as the OS of choice for this kind of platform for various reasons I don't need to address on this list (which is probably already getting annoyed with this level of detail on such a speculative project.) > Because Python was not written with such small memory environments in > mind, it is hard to retrofit it. You end up trying to > rewrite the core > so you can leave out things. (Pippy for example can get > down to about > 70k, if you chuck the parser/compiler, floating point, and some other > stuff.) You doubt that Python can get down to the 32k > requirements to > fit it on the cheap uProcessors. Yep. From Jonathan Pennington Wed Mar 21 00:32:23 2001 From: Jonathan Pennington (Jonathan Pennington) Date: Tue, 20 Mar 2001 19:32:23 -0500 Subject: [Edu-sig] The Educational Robotics Platform In-Reply-To: <8010912471E0D41189930090278D4E480FF379@SPAWN>; from smorris@cereva.com on Tue, Mar 20, 2001 at 04:55:50PM -0500 References: <8010912471E0D41189930090278D4E480FF379@SPAWN> Message-ID: <20010320193223.A17179@coastalgeology.org> > of platform for various reasons I don't need to address on this list (which > is probably already getting annoyed with this level of detail on such a > speculative project.) I've put the call out to moderate an embedded-SIG and form a list. There seems to be a lot of interest both on and offlist. If the meta-sigers are vehemently opposed, I'll start one from EGg0's SourceForge base. We'll give it a week or two. This way we can get back to education here. I'll let the list know when things happen. -J -- Jonathan Pennington | john@coastalgeology.org "A computer without windows is like a dog without bricks tied to its head." From fig@monitor.net Wed Mar 21 00:51:18 2001 From: fig@monitor.net (Stephen R. Figgins) Date: Tue, 20 Mar 2001 16:51:18 -0800 Subject: [Edu-sig] The Educational Robotics Platform References: <8010912471E0D41189930090278D4E480FF379@SPAWN> <20010320193223.A17179@coastalgeology.org> Message-ID: <3AB7FB06.F956C518@monitor.net> Hey, it all made good fodder for my weekly Python column. Look for it on the O'Reilly Network tomorrow evening. Thanks for the help in pulling it together. -Stephen From pdx4d@teleport.com Wed Mar 21 05:46:02 2001 From: pdx4d@teleport.com (Kirby Urner) Date: Tue, 20 Mar 2001 21:46:02 -0800 Subject: [Edu-sig] The Educational Robotics Platform In-Reply-To: <20010320193223.A17179@coastalgeology.org> References: <8010912471E0D41189930090278D4E480FF379@SPAWN> <8010912471E0D41189930090278D4E480FF379@SPAWN> Message-ID: <3.0.3.32.20010320214602.00b6aae0@pop3.norton.antivirus> >I've put the call out to moderate an embedded-SIG and form a >list. There seems to be a lot of interest both on and offlist. If the >meta-sigers are vehemently opposed, I'll start one from EGg0's >SourceForge base. We'll give it a week or two. This way we can get >back to education here. I'll let the list know when things happen. > >-J This whole thread was most interesting. I've seen a lot of interest in robotics in other contexts, e.g. in k12.ed.math. Definitely robots are educational, or potentially so. I wonder if it's cheating for a robot to have its "brains" in the PC, with some kind of wireless connection to the servos. Perhaps that's not any more cost effective. Wireless ethernet has certainly come down in price. Kirby From smorris@cereva.com Wed Mar 21 12:21:51 2001 From: smorris@cereva.com (Morris, Steve) Date: Wed, 21 Mar 2001 07:21:51 -0500 Subject: [Edu-sig] The Educational Robotics Platform Message-ID: <8010912471E0D41189930090278D4E480FF387@SPAWN> > I wonder if it's cheating for a robot to have its "brains" in the > PC, with some kind of wireless connection to the servos. Perhaps > that's not any more cost effective. Using a PC is definitely not cheating and can be much cheaper if you use an existing PC. The down side is that an existing PC will usually have a real time unfriendly OS like Windows or standard Linux which makes it difficult to use cheaper sensors. Cheap simple sensors require very fast response time because a lot of the work is done in software. Workstation type operating systems think nothing of turning off the outside world for major fractions of a second, fast for a human but slow for reacting to physical events that a robot sees. This is one of those design goal problems with workstations. Just like workstation tools like Python assume that plenty of disk and RAM is available, workstation OS' assume that they can hog time at human perception rates. A lot of work has been done in the last couple of years to make Linux compatible with real-time requirements, for example RTLinux, which directly address the low level robotics response time requirements. This will make Linux the OS of choice in coming years, especially as the cost of Linux capable platforms comes down. We are sitting at the cusp. John Pennington's work is addressing this. > Wireless Ethernet has certainly come down in price. True but unfortunately not in power consumption. Power is a big issue for robots since they have to carry their power supply. The main reason you don't want to use a PC with cable is that it limits the robots mobility. However many interesting robotics applications don't require mobility. It is very common to do both, use a workstation for development and an autonomous computer in the application. This is again where Jonathan's work is interesting. Things like Pippy run on many platforms. Another interesting application of robotics hardware is physics experiments. Some robot sensors can detect wheel angle. This allows doing things like putting a robot on a ramp, letting it roll and measuring the wheel angle with time. From this data and measured wheel size speed and acceleration with time can be calculated. From there the acceleration due to gravity can be measured. A little vector calculation with ramp angle and the force of gravity is measured. Data reduction can me done in Python on the workstation although I prefer a spreadsheet for this. When I do data reduction in a computer language I copy and paste the results into the program using it to initialize an array. LEGO Mindstorms itself might be responsive enough to do this experiment, especially with a shallow ramp to slow things down. Robots and their gears and pulleys are good platforms for learming about mechanical advantage and simple machines. A vital part of robotics development is measuring the behavior of the robot and its sensors. This process of analyzing real world attributes should be a good teaching tool. Simpler measurements can be factored into a lesson plan. Things like how close does the light sensor have to be before it sees an object (by reflection. LEGO light sensors have built-in light source.) Are different surfaces detected at different distances, different colors, shiny vs. flat. How does this impact the robots algorithm. This interactive process of quantifying and understanding physical properties is obviously quite valuable. A robotics professional has to understand computers and software, electronics and mechanical engineering, leverage and transfer of energy, noise, friction losses and efficiency, algorithm development, sensors and actuators, working within external constraints etc. There is rich ground here for all kinds of learning experiences. If Jonathan can make the connection between Python and robots Python can have a major role to play. From smorris@cereva.com Wed Mar 21 14:04:39 2001 From: smorris@cereva.com (Morris, Steve) Date: Wed, 21 Mar 2001 09:04:39 -0500 Subject: [Edu-sig] A potential LEGO Python robotics connection. Message-ID: <8010912471E0D41189930090278D4E480FF38C@SPAWN> There is a way to write LEGO robotics software in Python. The default firmware in the computer brick is a VM which hass immediate commands and downloadable software. On Windows LEGO provides a VXD (basically a software library) that does all the heavy lifting of interacting with the RCX computer. LEGO provides high quality documentation of how to use this VXD. A simple Python wrapper around this VXD makes all of the capapabilities of the machine available to Python running on the host. (The LEGO RCX has an infrared link to the PC.) This has already been implemented for many other Windows languages including C++, Visual Basic, Smalltalk, and Tcl to name a few. Someone may have even done it for Python already. These languages provide good examples of how to do it. The current language of choice for the RCX is called NQC (Not Quite C.) It is quite usable for teaching robotics, certainly much better than the graphical front end toy that LEGO delivers, but of course it is not Python so off topic for this list. NQC is basically a compiler that compiles to the native VM of the RCX. The reason it is Not Quite C is that the VM isn't powerful enough to support C. NQC is a C like language that efficiently lives within the restrictions of the RXC VM. Systems like LegOS and pbForth go one step further. They are firmware that replace the RCX VM completely. LegOS is C based and could theoretically support Pippy if it was small enough. The current state of the world of low end robotics is that platforms like the LEGO RCX are really too small and slow to do much and real platforms like PC/104 are too expensive and lack the basic infrastructure to glue high level languages to sensors and actuators. Moore's law is solving the PC/104 price problem and efforts like Jonathan's should solve the second. In five years robotics will be widely available for all levels of teaching. Today it is a path for the early adopter pioneers willing to do a lot of distracting (from the teaching point of view) nitty gritty work. From smorris@cereva.com Wed Mar 21 14:45:59 2001 From: smorris@cereva.com (Morris, Steve) Date: Wed, 21 Mar 2001 09:45:59 -0500 Subject: [Edu-sig] The Educational Robotics Platform Message-ID: <8010912471E0D41189930090278D4E480FF392@SPAWN> Kirby Urner wrote: > I wonder if it's cheating for a robot to have its "brains" in the > PC, with some kind of wireless connection to the servos. Perhaps > that's not any more cost effective. > > Wireless ethernet has certainly come down in price. Acually I missed your point the first time I read this so here is a better answer. Big brains in a host PC coupled with low level hands on the bits sensor/actuator control in the robot is a common model for robotics software development. Additionally a modern robot often has multiple computers on the robot connected with some kind of local area network. It is common for vision to be in one computer, looking at video data and extracting landmarks and object detail which then gets passed to some high level brain that makes decisions based on this info. Sometimes complicated details of the leg control of walking process (for legged robots) are delegated to a separate computer which is given high level objectives by the big brain. You still require a minimum threshold of compute power in the robot. (It has to be able to understand Ethernet for example.) Ethernet is also too slow for detailed control of the low level bits and bytes of sensors and actuators. This minimum level of compute power sets the low level price bar. Infrared is interesting because it can carry simple serial port data which makes it REALLY cheap. You just use standard TV remote IR parts and almost every embedded micro has a serial port built in. However infrared is even slower than Ethernet. To give you an idea, the inner loop of the LEGO RCX is some small number of thousandths of a second (I don't remember exactly but 2 milliseconds rings a bell.) Not much needs to be done in that inner loop but delays caused by other code will break the robot. The minimum low cost robotics processor is one that can do a couple of simple things every couple of milliseconds but also handle the high level decision making in the background. This low level stuff should be completely hidden from the programmer (in timer interrupt handlers etc) but the capability is necessary for the low level robot driver stuff. It is this mix of extremely frequent but low load processing responsiveness balanced with slower but more powerful and time consuming high level computation that defines the real-time programming problem. (That and the problem of many things happening in parallel.) It is this mix that Windows and out of the box Linux can't handle. The summary answer to your question is that high level processing that a host PC could do is not the hard part so offloading it doesn't save much if any money. On the other hand since a host CPU is often available (that's where you write the code) it is a valuable tool to increase what you can do with the robot. Using that host in conjunction with a remote link to the robot only increases the possibilities. It just doesn't solve the low cost minimum useful robotics platform problem. From pdx4d@teleport.com Thu Mar 22 10:03:00 2001 From: pdx4d@teleport.com (Kirby Urner) Date: Thu, 22 Mar 2001 02:03:00 -0800 Subject: [Edu-sig] Cryptonomicon In-Reply-To: <3.0.3.32.20010317110644.0344bd30@pop3.norton.antivirus> References: <3.0.3.32.20010315223922.00b5d900@pop3.norton.antivirus> <00580612.N22121@rsmi.com> Message-ID: <3.0.3.32.20010322020300.0396dad0@pop3.norton.antivirus> I've moved my 'group theory and cryptology with Python' stuff to the web, a four part thingy starting at: http://www.inetarena.com/~pdx4d/ocn/crypto0.html The last page is very much under construction. The others are closer to done, but still subject to revision and extension. It's not the easiest stuff in the world, but then it's not that bad, really, and I think actually fun and accessible if you have the kind of interactivity which Python provides. Someone who is already into the subject material somewhat might be comfortable with that part, and use the writing to familiarize herself with Python. On the other hand, if you're new to group theory and/or cryptology but know Python somewhat, then here's a way to wrap your brain around the material using Python skills you already have. I'd like to test teach this kind of stuff to younger kids, say to 8th graders. In a well-equipped classroom, providing hands-on, and providing the teacher with the means to project a computer screen for all to view, I bet I could get this material across. My wife thought it was pretty easy when I quickly did a show and tell re what I've been working on (between billable hours for clients), but then she's something of a math head (another geek like me). It may be a few days before I get back to page 4. I realize this writing is dense and no fun if you're not in the mood. But if anyone happens to groove on such topics, feel free to send feedback. Kirby From m_konermann@gmx.de Sun Mar 25 15:09:24 2001 From: m_konermann@gmx.de (Marcus Konermann) Date: Sun, 25 Mar 2001 17:09:24 +0200 Subject: [Edu-sig] need help on =?iso-8859-1?Q?python=B4s?= glob module Message-ID: <3ABE0A23.2EB4C967@gmx.de> Hallo ! i´m programming a project in my graduation with python an need help on python´s glob module. I don´t know the search routine, in which python searches through different files. For example: I let python search through the actuall directory with the command *.out (which specifies all files ending of ".out"). There are three files in the actuall directory named: ist.out, soll.out and rc.out. First, python takes the "rc.out" file, then the "ist.out" file and at last the "soll.out" file. So, it seems not to be an alphabetical order, in which python searches through this files. Please, can you tell me the search routine for python´s glob module ? Thanks a lot Grettings Marcus Konermann From fred@ontosys.com Sun Mar 25 16:09:39 2001 From: fred@ontosys.com (Fred Yankowski) Date: Sun, 25 Mar 2001 10:09:39 -0600 Subject: [Edu-sig] VPython/Tk visualization of residue classes Message-ID: <20010325100939.A79198@enteract.com> I've been experimenting with ways to provide animated visualizations of simple mathematical concepts, and I'm fairly pleased with my latest effort which displays "residue classes" for different modulus values. The VPython/Tk program is available temporarily at . Note the Tk controller window that starts up along with the VPython display window. This program is motivated by the material in Chapter 2 of Conway and Guy's "The Book of Numbers" book. I think someone on this list recommended the book; it is a wonderful exposition of various patterns of numbers. -- Fred Yankowski fred@OntoSys.com tel: +1.630.879.1312 Principal Consultant www.OntoSys.com fax: +1.630.879.1370 OntoSys, Inc 38W242 Deerpath Rd, Batavia, IL 60510, USA From emmanuel.viennet@lipn.univ-paris13.fr Sun Mar 25 17:12:11 2001 From: emmanuel.viennet@lipn.univ-paris13.fr (Emmanuel Viennet) Date: Sun, 25 Mar 2001 19:12:11 +0200 Subject: [Edu-sig] need help on =?iso-8859-1?Q?python=B4s?= glob module References: <3ABE0A23.2EB4C967@gmx.de> Message-ID: <3ABE26EB.83A5B9BD@lipn.univ-paris13.fr> glob returns an unsorted list of matching files. You can call the sort() method to get what you want: import glob filelist = glob.glob( '*.py' ) filelist.sort() for filename in filelist: # process filename... Enjoy ! Emmanuel From dyoo@hkn.eecs.berkeley.edu Tue Mar 27 20:23:26 2001 From: dyoo@hkn.eecs.berkeley.edu (Daniel Yoo) Date: Tue, 27 Mar 2001 12:23:26 -0800 (PST) Subject: [Edu-sig] need help on =?iso-8859-1?Q?python=B4s?= glob module In-Reply-To: <3ABE0A23.2EB4C967@gmx.de> Message-ID: Dear Marcus, You might get better results if you ask tutor@python.org or comp.lang.python; edu-sig is meant for people talking about the educational aspects of teaching Python, so I'm not sure if anyone's here can help explain how glob.glob() works. On the other hand, comp.lang.python and tutor@python.org has a bunch of people that would be happy to help you out. You can contact both here: http://mail.python.org/mailman/listinfo/python-list http://mail.python.org/mailman/listinfo/tutor By the way, if you really want to see how glob.glob works, you can take a look at its source code; it itself is written in Python, which is nice. Try doing a search on your computer for the file "glob.py", and you should be able to find it. As far as I can tell, it's not alphabetic. It depends on the os.path functions and does lots of recursive stuff, but it doesn't seem to difficult to read. If you have any questions on it, please feel free to ask us on comp.lang.python or tutor. Good luck to you. From pdx4d@teleport.com Tue Mar 27 23:06:58 2001 From: pdx4d@teleport.com (Kirby Urner) Date: Tue, 27 Mar 2001 15:06:58 -0800 Subject: [Edu-sig] VPython/Tk visualization of residue classes In-Reply-To: <20010325100939.A79198@enteract.com> Message-ID: <3.0.3.32.20010327150658.0144a5fc@pop3.norton.antivirus> >This program is motivated by the material in Chapter 2 of Conway and >Guy's "The Book of Numbers" book. I think someone on this list >recommended the book; it is a wonderful exposition of various patterns >of numbers. > >-- >Fred Yankowski fred@OntoSys.com tel: +1.630.879.1312 Belated response Fred. I'm interested in what you're doing. 'Book of Numbers' was first mentioned by another poster saying my 'Numeracy + Computer Literacy' series reminded her (?) of this book: http://www.inetarena.com/~pdx4d/ocn/numeracy0.html I didn't know what she meant exactly, and I didn't run out to check right away -- was feeling kinda down on Conway, the world famous mathematician, 'cause he'd been dissing one of my fave teachers over on geometry_research (Math Forum)... Anyway, I've since checked it out from the library, and lo and behold, _lots_ of the same threads. Way cool. And I've just been playing with residue classes myself in the crypto + group theory + python paper I've been working on of late: http://www.inetarena.com/~pdx4d/ocn/crypto0.html I don't have VPython running yet. It wants to install to my C drive for some reason, plus I'm only using 2.1 and will never go back (burned all bridges) -- not sure it works w/ 2.1 yet. I encourage you to do a write-up re your project on the web if you think that's worth your while. That's where you can show how to operate with your code, explain what it does, and maybe give some screen shots, for those not actually running the right stuff. Just a thought. Kirby From dyoo@hkn.eecs.berkeley.edu Thu Mar 29 10:57:57 2001 From: dyoo@hkn.eecs.berkeley.edu (Daniel Yoo) Date: Thu, 29 Mar 2001 02:57:57 -0800 (PST) Subject: [Edu-sig] [Python-Help] Certification (fwd) Message-ID: Dear Waldo, I'll forward you message to the edu-sig folks for you; they're definitely the people you want to talk to about Python in education. I hope that they'll be able to help answer your questions on certification. Off the top of my head: Learning Tree offers a course in Python programming: http://www.learningtree.com/ http://www.learningtree.com/us/ilt/courses/430.htm and they seem to focus on certification a bit, so you might want to talk to them. I'll let the other edu-sig'ers give their insight to your question too... *grin* Good luck to you. ---------- Forwarded message ---------- Date: Tue, 27 Mar 2001 17:50:14 -0500 From: Waldo Jaquith To: help@python.org Subject: [Python-Help] Certification Folks, This probably isn't the best address to write to, but I'm really not interested in joining any mailing lists or anything right now. I'm a board member of the Information Technology Academy in Charlottesville, Virginia, USA. In a nutshell, we're working with local public schools to offer programming and computer-related education. Such things exist in schools now, but, frankly, they suck. I want to start kids off with Python. It's the best language to start on, or so people keep telling me. Right now they start on Visual Basic, which is disgusting. The problem is that you can't teach kids things in school unless you can prove that they've learned something. And to prove that they've learned something, you have to have a test. And to have a test, you have to be able to develop some sort of standards, or demonstrate that the standards exist. I'm not about to lobby the Commonwealth of Virginia to accept whatever Python standards that I might decide are good. On the other hand, if there were a commercial entity (non-profit or otherwise) that created a Python certification program, that would be good enough for the board of education. So my question is this: is there now, or will there soon be, such certification? I know such measurements are worthless to you and me, but they're essential to get Python in the classroom. Thanks for your time. Best, Waldo -- #define K(i)(x[i]^s[i+84])<< unsigned char x[5],y,z,s[2048];main(n){for(read(0,x,5);read(0,s,n=2048); write(1,s,n))if(s[y=s[13]%8+20]/16%4==1){int i=K(1)17^256+K(0)8,k=K(2)0, j=K(4)17^K(3)9^k*2-k%8^8,a=0,b=0,c=26;for(s[y]-=16;--c;i/=2,j/=2)a=a*2^1 &1,b=b*2^j&1;for(j=127;++jy)a^=a>>14,a=a>>8^(y=a^a*8^a<<6)<<9, b=b>>8^(z=b^b/8^b>>4^b>>12)<<17,i=s[j],i="7Wo~'G_\216"[i&7]+2^"cr3sfw6v; *k+>/n."[i>>4]*2^i*257/8,s[j]=i^(i&i*2&34)*6^z+c+~y;}} Charles M. Hannum _______________________________________________ Python-Help maillist - Python-Help@python.org http://mail.python.org/mailman/listinfo/python-help From agauld@crosswinds.net Fri Mar 30 03:53:43 2001 From: agauld@crosswinds.net (Alan Gauld) Date: Fri, 30 Mar 2001 08:53:43 +0500 Subject: [Edu-sig] [Python-Help] Certification (fwd) Message-ID: <3ac48fe7.14685.0@crosswinds.net> >I want to start kids off with Python. It's the best language I won't argue with that... > Right now they start on Visual Basic, which is disgusting. But I would argue with that. VB is a far better language to teach in a controlled (ie classroom) environment than say Java or, worse still, C++. It's certainly not disgusting, modern VB has most of the things needed for teaching introductory programming. But Python is better because it takes you further before running out of steam. :-) >a Python certification program, that would be good >enough for the board of education. Sorry, can't help you there. I can't even get my employer to feel happy about Python, never mind an education authority! Alan G. From bic@cgl.ucsf.edu Sat Mar 31 03:19:03 2001 From: bic@cgl.ucsf.edu (Bruce Cohen) Date: Fri, 30 Mar 2001 19:19:03 -0800 Subject: [Edu-sig] introduction and more on Cards Message-ID: <3.0.6.32.20010330191903.008c1420@mail.serpnet.net> It looks like the time has come to join this list. The thread on Card classes is just what I am doing right now. I am a math teacher at Lowell High School in San Francisco. I have not taught programming since 1981, but I was asked to teach a C++ course this year. The one semester course is supposed to prepare students who want to take the 1 year AP computer science class next year. Despite the fact that the College Board uses C++ as the AP vehicle (until they switch to Java in 2003?), I don't think C++ is the place to begin. Through my connections with the Computer Graphics Lab at UCSF (where the new molecular modeling package is written in Python ), I became aware of Python. The more I learn about Python, the more I am convinced that it is a wonderful environment for students. I too recently thought about using a deck of cards to introduce objects to my students. In fact, I really wanted this for myself. Having done a good deal of C programming in the early '80s and Lisp in the late '80s, I had a decent understanding of programming paradigms, but no experience with OOP. My Card, Deck, and Hand classes look similar to the ones I have just discovered in the archives of this SIG. My first thought is to have students build a simulation of the game of "war" (see the description at the end of this e-mail). The boring nature of the game makes it ripe for computer data collection. (See http://home.att.net/~dambrosia/programming/games/war/ and http://www-ugrad.cs.colorado.edu/~kelloggp/War/index.html) As a novice with respect to object oriented programming, I would appreciate reactions to these two ideas: 1) using __cmp__ to overload comparisons. e.g. class Card: def __init__(self, Suit="spades", Value="Ace"): self._suit = Suit self._value = Value def __repr__(self): return str(self._value)+" of "+self._suit def __cmp__(self,other): if values.index(self._value) < values.index(other._value): return -1 elif values.index(self._value) > values.index(other._value): return 1 else: return 0 2) using inheritance: My Card class is good for war. Another game may require a different ordering (e.g. suits come into play). A second Card class (say SuitCard) could be based on Card but have a different overloading of __cmp__ Thanks. -Bruce ----------------------------------------------------------- (from http://www-ugrad.cs.colorado.edu/~kelloggp/War/index.html) The Rules of War (from Hoyle's Book of Card Games) Primarily a two-player game, preferably for juveniles, with a fifty-two-card pack ranking A, K, Q, J, 10, 9, 8, 7, 6, 5, 4, 3, 2 with suits disregarded. Each is dealt twenty-six cards face down, and each turns his top card face up. The higher value takes the lower and the cards are placed face down beneath the winner's packet. This continues indefinitely, until one player has won all the other's cards. If two cards happen to be tied - as two tens - they are laid aside and go to the winner of the next turnup. The player who gathers in all the cards wins the game. As an added rule, after a tie, each player lays a card face down before turning up another; and these cards also go to the winner of the next turnup. From pdx4d@teleport.com Sat Mar 31 05:09:03 2001 From: pdx4d@teleport.com (Kirby Urner) Date: Fri, 30 Mar 2001 21:09:03 -0800 Subject: [Edu-sig] introduction and more on Cards In-Reply-To: <3.0.6.32.20010330191903.008c1420@mail.serpnet.net> Message-ID: <3.0.3.32.20010330210903.014695cc@pop3.norton.antivirus> Your card class looks good to me. Seems in all posts to the cards thread so far we've been ignoring the jokers. Is a joker a subclass of card I wonder. Kirby