From csev at umich.edu Mon Mar 3 18:55:06 2008 From: csev at umich.edu (csev) Date: Mon, 3 Mar 2008 12:55:06 -0500 Subject: [Edu-sig] Question abut teaching using a MUD Message-ID: <0BD82ED0-789D-451F-888A-59D13F277FDC@umich.edu> Hi all, I am teaching an undergraduate course in Python at the University of Michigan (www.si182.com) and several students expressed an interest in building online text-based games. I am wondering if anyone nkows of or has used a Python MUD in a teaching environment and might have some suggestions for me. Charles Severance University of Michigan P.S. See you all at Pycon 08 in Chicago :) From winstonw at stratolab.com Mon Mar 3 20:57:50 2008 From: winstonw at stratolab.com (winston wolff) Date: Mon, 3 Mar 2008 14:57:50 -0500 (EST) Subject: [Edu-sig] Question abut teaching using a MUD In-Reply-To: <0BD82ED0-789D-451F-888A-59D13F277FDC@umich.edu> References: <0BD82ED0-789D-451F-888A-59D13F277FDC@umich.edu> Message-ID: <39378.165.155.200.85.1204574270.squirrel@mail2.webfaction.com> I tried using a MUD for teaching, and my problem was that only 2 out of 30 of my students thought it was interesting. I think if you can get a selected group of intersted students, it would be great. It creates an environment where a one or two line program is already doing something interesting. I found a Python implementation of a MUD someplace, but I can't remember where. It seemed to work in a rudimentary form. I didn't think it was "ready for prime time" and used a regular MUD for my test class. -Winston > Hi all, > > I am teaching an undergraduate course in Python at the University of > Michigan (www.si182.com) and several students expressed an interest in > building online text-based games. > > I am wondering if anyone nkows of or has used a Python MUD in a > teaching environment and might have some suggestions for me. > > Charles Severance > University of Michigan > > P.S. See you all at Pycon 08 in Chicago :) > _______________________________________________ > Edu-sig mailing list > Edu-sig at python.org > http://mail.python.org/mailman/listinfo/edu-sig > From kirby.urner at gmail.com Mon Mar 3 21:08:40 2008 From: kirby.urner at gmail.com (kirby urner) Date: Mon, 3 Mar 2008 12:08:40 -0800 Subject: [Edu-sig] Question abut teaching using a MUD In-Reply-To: <0BD82ED0-789D-451F-888A-59D13F277FDC@umich.edu> References: <0BD82ED0-789D-451F-888A-59D13F277FDC@umich.edu> Message-ID: I was an online adviser for this Eagle Scout wannabe who needed a project, community service type. His project: to make online Quaker meeting a reality by gutting a pre-existing MUD and outfitting it with Quakery rooms and characters (some bots, some other denizens). Upshot: successful, got the badge, but offended a test user when one of the worshipers spasmed out, having been zapped by a goddess weapon of some kind (stuff he'd forgotten to remove). My more general advice (the above just an anecdote), is to find something big and sprawling, try diving into it, get screens full of code ASAP. A big danger with (some) newbies is Blank Screen Syndrome (BSs) and a prolonged feeling of duhhhhhhhhhhhh.... makes for quick burnout and disillusionment. More fun to be reading, like when learning any alien language (e.g. Klingon, Python, whatever), flipping between design time and run time (yes, code is breakable, enter version control). Kirby On Mon, Mar 3, 2008 at 9:55 AM, csev wrote: > Hi all, > > I am teaching an undergraduate course in Python at the University of > Michigan (www.si182.com) and several students expressed an interest in > building online text-based games. > > I am wondering if anyone nkows of or has used a Python MUD in a > teaching environment and might have some suggestions for me. > > Charles Severance > University of Michigan > > P.S. See you all at Pycon 08 in Chicago :) > _______________________________________________ > Edu-sig mailing list > Edu-sig at python.org > http://mail.python.org/mailman/listinfo/edu-sig > From kirby.urner at gmail.com Fri Mar 7 00:33:26 2008 From: kirby.urner at gmail.com (kirby urner) Date: Thu, 6 Mar 2008 15:33:26 -0800 Subject: [Edu-sig] Pythonic eToyz Message-ID: So I'm appending some code I'm kicking around in anticipation of Pycon, call it "ambient Python for airports" (hello Brian Eno). Given a specific sequence of math topics mostly motivates our pathway through Python (starting with using it as a calculator), we're likely: (a) to encounter generators early (e.g. for Fibonacci numbers), then (b) very simple classes, with emphasis on operator overloading. while of course (c) ordinary functions, like "def f(x): return x**2" will always be a part of it, along with those plotting libraries. I.E. this isn't a CS course where you do procedural programming for a year, before classes even get mentioned (such a methodic and detailed approach will be left to a college setting -- this is college prep). In a first pass, we provide the code below as scaffolding, explaining as we go, *not* requiring students to write it all from scratch (though some might -- plus there's room for improvement (see comments)). When learning a language (human or computer), you want to eyeball existing code, get used to the look in feel, e.g. in this case Python's trademark __rib__ syntax. So below is a good example of a class we'd encounter early in our high school math learning career. All it does is implement the four operations, plus the ordering operators (< , >, ==), among integers modulo M, with the modulus set at the class level. We want students to have interactive experiences like: >>> from chicago2 import M >>> M.modulus 7 >>> m2 = M(2) >>> m4 = M(4) >>> m2 * m4 m1 >>> m2 / m4 m4 >>> m4 ** 2 m2 >>> [m2 ** i for i in range(10)] [m1, m2, m4, m1, m2, m4, m1, m2, m4, m1] Note we don't get a nice division operation for every modulus, as there's not always a unique multiplicative inverse -- part of what we're learning about (group, ring and field -- a first pass, non-exhaustive). We're putting more emphasis on modulo arithmetic, as well as concepts of gcd, coprime, because we're aiming to encompass RSA the public key algorithm by senior year high school, ala Sarah Flannery's 'In Code' (a bestseller).** Kirby Primary reference: A. Bogomolny, Modular Arithmetic from Interactive Mathematics Miscellany and Puzzles http://www.cut-the-knot.org/blue/Modulo.shtml, Accessed 06 March 2008 Secondary reference: Urner, K. Vegetable Group Soup http://urnerk.webfactional.com/ocn/flash/group.html (apologies for the annoying machine noise) ** http://en.wikipedia.org/wiki/Sarah_Flannery #=== test code === class M: modulus = 7 def __init__(self, val): self.val = val % M.modulus # looking for mult. inverse (primitive brute force, # could use extended Euclid instead) for i in range(1, M.modulus): if (self.val * i) % M.modulus == 1: self.recip = i break def __repr__(self): return "%s mod %s" % (self.val, M.modulus) # note: all of these return M-type objects def __add__(self, other): return M(self.val + other.val) def __sub__(self, other): return self + (-other) def __mul__(self, other): return M(self.val * other.val) def __truediv__(self, other): return self * other**(-1) def __neg__(self): return M(-self.val) def __pow__(self, e): # note: m ** (-e) == (m ** (-1)) ** e if e < 0: base = self.recip else: base = self.val return M(pow(base, abs(e), self.modulus)) #======= ordering operators def __lt__(self, other): return self.val < other.val def __gt__(self, other): return self.val > other.val def __eq__(self, other): return self.val == other.val From kirby.urner at gmail.com Fri Mar 7 02:50:44 2008 From: kirby.urner at gmail.com (kirby urner) Date: Thu, 6 Mar 2008 17:50:44 -0800 Subject: [Edu-sig] Pythonic eToyz In-Reply-To: References: Message-ID: > In a first pass, we provide the code below as scaffolding, explaining > as we go, *not* requiring students to write it all from scratch > (though some might -- plus there's room for improvement (see > comments)). Just a small refinement, slightly more advanced: """ Special to edu-sig by K. Urner: see previous post for M class on which Mx is based. Just adding a better way for finding multiplicative inverses modulo M using Euclid's Extended Algorithm (ee). See also: Algorithms: A Bit of Math by Andrew Kuchling http://pythonjournal.cognizor.com/pyj1/AMKuchling_algorithms-V1.html Copyright (c) 1998 Andrew Kuchling """ from chicago2 import M def ee(a, b): """Euclid extended by Alexandru Scvortov http://snippets.dzone.com/posts/show/4192 """ if b == 0: return a, 1, 0 dd, xx, yy = ee(b, a % b) d, x, y = dd, yy, xx - (a // b) * yy return d, x, y class Mx(M): """ Adds extended Euclidean (ee) for finding multiplicative inverses """ def __init__(self, val): self.val = val % M.modulus self.recip = ee(self.val, M.modulus)[1] % M.modulus # everything else the same as M-type From kirby.urner at gmail.com Sat Mar 8 01:46:01 2008 From: kirby.urner at gmail.com (kirby urner) Date: Fri, 7 Mar 2008 16:46:01 -0800 Subject: [Edu-sig] Pythonic eToyz In-Reply-To: References: Message-ID: PS: this edu-sig Python community thread took me to the following blog post (hi Anna): http://controlroom.blogspot.com/2008/03/snap-shot.html Kirby On Thu, Mar 6, 2008 at 3:33 PM, kirby urner wrote: > So I'm appending some code I'm kicking around in anticipation > of Pycon, call it "ambient Python for airports" (hello Brian Eno). > From macquigg at ece.arizona.edu Tue Mar 11 03:28:21 2008 From: macquigg at ece.arizona.edu (David MacQuigg) Date: Mon, 10 Mar 2008 19:28:21 -0700 Subject: [Edu-sig] Introducing Python to Engineering Students Message-ID: <5.2.1.1.0.20080310192814.00f03e70@pop.mail.yahoo.com> I've been asked to give an intro to Python for a freshman class with 150 students at University of Arizona. The class is taught in the Electrical and Computer Engineering Department, and is titled Computer Programming for Engineering Applications. The language is C (Hanly & Koffman, Problem Solving and Program Design in C). I think a nice way to do this will be an application where we can show the advantages of both languages - the computation of Mandelbrot images http://en.wikipedia.org/wiki/Mandelbrot_set. Python will provide the high-level "glue" which brings everything together in a nice programming environment, and C will provide the raw power for the loop that actually computes the pixels. My initial tests show this loop running about 100 times faster in C than in Python. The challenge is to do this without overwhelming the students. The plan is to make everything as simple as possible, just follow the instructions, except the loop itself, which the students will write in C, based on what I have written in Python. See http://ece.arizona.edu/~edatools/ece175/projects/mandelbrots/mbrotHW.html. Suggestions are welcome. Has anyone done something like this before? Can you improve on my code (I'm not a Python expert), or even suggest something entirely different? There is one major piece I would like to add to what I have so far - output graphics. This demo would really be cool if the students could see these glorious images appear on their screen instead of an array of numbers. I looked at the Python Imaging Library http://www.pythonware.com/products/pil/index.htm, and I don't see any examples that I can work from in converting an array of numbers into an image, just a lot of dense reference material that assumes I already know these image data formats. Maybe there is a simpler way. Help from someone with experience in Python graphics would be most appreciated. -- Dave From kirby.urner at gmail.com Tue Mar 11 04:00:47 2008 From: kirby.urner at gmail.com (kirby urner) Date: Mon, 10 Mar 2008 20:00:47 -0700 Subject: [Edu-sig] Introducing Python to Engineering Students In-Reply-To: <5.2.1.1.0.20080310192814.00f03e70@pop.mail.yahoo.com> References: <5.2.1.1.0.20080310192814.00f03e70@pop.mail.yahoo.com> Message-ID: On Mon, Mar 10, 2008 at 7:28 PM, David MacQuigg wrote: > Suggestions are welcome. Has anyone done something like this before? Can you improve on my code (I'm not a Python expert), or even suggest something entirely different? Hi Dave -- Just in case you want to look at an "all Python" solution down to the pixel level (using PIL): http://4dsolutions.net/ocn/fractals.html I don't claim it's fast, just conceptually illustrative. Kirby From warren.sande at rogers.com Tue Mar 11 05:20:02 2008 From: warren.sande at rogers.com (Warren Sande) Date: Mon, 10 Mar 2008 21:20:02 -0700 (PDT) Subject: [Edu-sig] Introducing Python to Engineering Students Message-ID: <712368.65090.qm@web88108.mail.re2.yahoo.com> David, For output graphics, you might want to have a look at Pygame. It is a wrapper for the SDL library. It has functionality for creating graphics windows, drawing, sprites, etc. But what might be of interest for you is the simple set_at(x,y) method, to set the color of individual pixels in a window. I have found the Pygame documentation to be pretty good. Here is a simple example of plotting a sinewave using set_at() #----------------------------- import pygame, sys, math screen = pygame.display.set_mode([640,480]) for x in range(0, 640): y = int(math.sin(x/640.0 * 4 * math.pi) * 200 + 240) screen.set_at([x, y],[255,0,0]) pygame.display.flip() while True: for event in pygame.event.get(): if event.type == pygame.QUIT: sys.exit() #------------------------------ Warren Sande ----- Original Message ---- From: David MacQuigg To: edu-sig at python.org Sent: Monday, March 10, 2008 10:28:21 PM Subject: [Edu-sig] Introducing Python to Engineering Students I've been asked to give an intro to Python for a freshman class with 150 students at University of Arizona. The class is taught in the Electrical and Computer Engineering Department, and is titled Computer Programming for Engineering Applications. The language is C (Hanly & Koffman, Problem Solving and Program Design in C). I think a nice way to do this will be an application where we can show the advantages of both languages - the computation of Mandelbrot images http://en.wikipedia.org/wiki/Mandelbrot_set. Python will provide the high-level "glue" which brings everything together in a nice programming environment, and C will provide the raw power for the loop that actually computes the pixels. My initial tests show this loop running about 100 times faster in C than in Python. The challenge is to do this without overwhelming the students. The plan is to make everything as simple as possible, just follow the instructions, except the loop itself, which the students will write in C, based on what I have written in Python. See http://ece.arizona.edu/~edatools/ece175/projects/mandelbrots/mbrotHW.html. Suggestions are welcome. Has anyone done something like this before? Can you improve on my code (I'm not a Python expert), or even suggest something entirely different? There is one major piece I would like to add to what I have so far - output graphics. This demo would really be cool if the students could see these glorious images appear on their screen instead of an array of numbers. I looked at the Python Imaging Library http://www.pythonware.com/products/pil/index.htm, and I don't see any examples that I can work from in converting an array of numbers into an image, just a lot of dense reference material that assumes I already know these image data formats. Maybe there is a simpler way. Help from someone with experience in Python graphics would be most appreciated. -- Dave _______________________________________________ Edu-sig mailing list Edu-sig at python.org http://mail.python.org/mailman/listinfo/edu-sig -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/edu-sig/attachments/20080310/ce6f8f1e/attachment.htm From sb at csse.unimelb.edu.au Tue Mar 11 11:14:40 2008 From: sb at csse.unimelb.edu.au (Steven Bird) Date: Tue, 11 Mar 2008 21:14:40 +1100 Subject: [Edu-sig] Introducing Python to Engineering Students In-Reply-To: <712368.65090.qm@web88108.mail.re2.yahoo.com> References: <712368.65090.qm@web88108.mail.re2.yahoo.com> Message-ID: <97e4e62e0803110314n4bd24f08p723c2e1eaebe72d2@mail.gmail.com> We're considering this book for adoption in a second year programming course for Engineers: Numerical Methods in Engineering with Python by Jaan Kiusalaas http://www.amazon.com/Numerical-Methods-Engineering-Python-Kiusalaas/dp/0521852870 Steven Bird http://www.csse.unimelb.edu.au/~sb/ On 3/11/08, Warren Sande wrote: > > David, > > For output graphics, you might want to have a look at Pygame. It is a > wrapper for the SDL library. It has functionality for creating graphics > windows, drawing, sprites, etc. But what might be of interest for you is > the simple set_at(x,y) method, to set the color of individual pixels in a > window. > > I have found the Pygame documentation to be pretty good. > > Here is a simple example of plotting a sinewave using set_at() > > #----------------------------- > import pygame, sys, math > screen = pygame.display.set_mode([640,480]) > for x in range(0, 640): > y = int(math.sin(x/640.0 * 4 * math.pi) * 200 + 240) > screen.set_at([x, y],[255,0,0]) > pygame.display.flip() > while True: > for event in pygame.event.get(): > if event.type == pygame.QUIT: > sys.exit() > #------------------------------ > > Warren Sande > > > ----- Original Message ---- > From: David MacQuigg > To: edu-sig at python.org > Sent: Monday, March 10, 2008 10:28:21 PM > Subject: [Edu-sig] Introducing Python to Engineering Students > > I've been asked to give an intro to Python for a freshman class with 150 > students at University of Arizona. The class is taught in the Electrical > and Computer Engineering Department, and is titled Computer Programming for > Engineering Applications. The language is C (Hanly & Koffman, Problem > Solving and Program Design in C). > > I think a nice way to do this will be an application where we can show the > advantages of both languages - the computation of Mandelbrot images > http://en.wikipedia.org/wiki/Mandelbrot_set. Python will > provide the high-level "glue" which brings everything together in a nice > programming environment, and C will provide the raw power for the loop that > actually computes the pixels. My initial tests show this loop running about > 100 times faster in C than in Python. > > The challenge is to do this without overwhelming the students. The plan is > to make everything as simple as possible, just follow the instructions, > except the loop itself, which the students will write in C, based on what I > have written in Python. See > http://ece.arizona.edu/~edatools/ece175/projects/mandelbrots/mbrotHW.html. > > Suggestions are welcome. Has anyone done something like this before? Can > you improve on my code (I'm not a Python expert), or even suggest something > entirely different? > > There is one major piece I would like to add to what I have so far - output > graphics. This demo would really be cool if the students could see these > glorious images appear on their screen instead of an array of numbers. I > looked at the Python Imaging Library > http://www.pythonware.com/products/pil/index.htm, and I > don't see any examples that I can work from in converting an array of > numbers into an image, just a lot of dense reference material that assumes I > already know these image data formats. Maybe there is a simpler way. Help > from someone with experience in Python graphics would be most appreciated. > > -- Dave > > > > _______________________________________________ > Edu-sig mailing list > Edu-sig at python.org > http://mail.python.org/mailman/listinfo/edu-sig > > > _______________________________________________ > Edu-sig mailing list > Edu-sig at python.org > http://mail.python.org/mailman/listinfo/edu-sig > > From macquigg at ece.arizona.edu Tue Mar 11 22:57:58 2008 From: macquigg at ece.arizona.edu (David MacQuigg) Date: Tue, 11 Mar 2008 14:57:58 -0700 Subject: [Edu-sig] Introducing Python to Engineering Students In-Reply-To: References: <5.2.1.1.0.20080310192814.00f03e70@pop.mail.yahoo.com> <5.2.1.1.0.20080310192814.00f03e70@pop.mail.yahoo.com> Message-ID: <5.2.1.1.0.20080311125543.03926900@mail.ece.arizona.edu> Many thanks for the quick and very helpful responses!! At 08:00 PM 3/10/2008 -0700, kirby urner wrote: >Just in case you want to look at an "all Python" solution down to the >pixel level (using PIL): > >http://4dsolutions.net/ocn/fractals.html Very nice!! I like the clear concise explanation of fractals. I'll add this link to whatever I put together. I like the way you construct the color palette, simple but effective. I'll have to play around with some more high-resolution images to see if I still get such nice colors. I see you have a link on creating palettes, but it is dead. This module would make a very nice example for the PIL handbook. They should at least link to your page. >I don't claim it's fast, just conceptually illustrative. It seems to run about as fast as my Python function, even though I've made some efforts to optimize the performance of my Python code (100 points per function call, separating real & imaginary parts, etc.). I guess what I should conclude is that when performance is important, don't bother trying to optimize Python. Go straight to C, and get 10 or 100X improvement. I'll modify my function to look more like yours, going for more clarity with only a small sacrifice in efficiency. I can't use the nice OOP style, however, because these students have studied only functions. OOP is an "advanced topic" covered in a later course for computer engineers, and not at all for electrical and other engineering majors. :( At 09:17 PM 3/10/2008 -0700, Warren Sande wrote: >For output graphics, you might want to have a look at Pygame. I like the ability to create the image in real time directly on the screen, instead of to a file. This should make the demo a little more interactive, and visually emphasize the speed difference between Python and C. At 09:14 PM 3/11/2008 +1100, Steven Bird wrote: >We're considering this book for adoption in a second year programming >course for Engineers: > >Numerical Methods in Engineering with Python by Jaan Kiusalaas >http://www.amazon.com/Numerical-Methods-Engineering-Python-Kiusalaas/dp/0521852870 Looks interesting, but not enough on Python for what I would like, and perhaps too much overlap with what the students learn using Matlab in other courses. For a second-year programming course, I would chose Martelli's "Python in a Nutshell", then supplement it with lots of examples, especially rewrites of examples students have seen already in C and Java. The improvements in clarity are dramatic. For a first-year course, I would chose Zelle's "Python Programming". By the way, I'm not on the faculty, just an engineer with an interest in teaching. -- Dave http://ece.arizona.edu/~edatools From macquigg at ece.arizona.edu Wed Mar 12 01:11:45 2008 From: macquigg at ece.arizona.edu (David MacQuigg) Date: Tue, 11 Mar 2008 17:11:45 -0700 Subject: [Edu-sig] Introducing Python to Engineering Students Message-ID: <5.2.1.1.0.20080311170340.03959b10@mail.ece.arizona.edu> At 03:12 PM 3/11/2008 -0700, Rob Malouf wrote: >On Mar 11, 2008, at 2:57 PM, David MacQuigg wrote: >> I guess what I should conclude is that when performance is >>important, don't bother trying to optimize Python. Go straight to >>C, and get 10 or 100X improvement. > >That hasn't always been my experience. I found that using psyco and >numpy (along with careful profiling and optimization), I can often get >essentially the same performance from pure Python that I can get from >mixed Python/C solutions, and with much less trouble. I agree that the Python/C interface is more trouble than it should be, especially for freshman engineering students and technical professionals who don't have time for messy programming details. What I would like to see is something like a simple "directive" I could put in my Python code to say "The following function is in C", and have Python set up the linkage for me. It would make a nice improvement in this Mandelbrot demo if you could show me a way to significantly improve the speed of the Python I already have, perhaps avoiding the need for C. I've posted the complete Python module at http://ece.arizona.edu/~edatools/ece175/projects/mandelbrots/mandel.py Just run the command $ python mandel.py and you should see the output from two examples in the doctests: 1a) Python speed = 787 points/sec 1b) C speed = 125500 points/sec 2a) Python speed = 823 points/sec 2b) C speed = 134300 points/sec The C source, mandelbrotC.c, is also in that same directory. The tests above were done on an old Windows machine running Cygwin. -- Dave From rmalouf at MAIL.SDSU.EDU Wed Mar 12 01:29:35 2008 From: rmalouf at MAIL.SDSU.EDU (Rob Malouf) Date: Tue, 11 Mar 2008 17:29:35 -0700 Subject: [Edu-sig] Introducing Python to Engineering Students In-Reply-To: <5.2.1.1.0.20080311170340.03959b10@mail.ece.arizona.edu> References: <5.2.1.1.0.20080311170340.03959b10@mail.ece.arizona.edu> Message-ID: On Mar 11, 2008, at 5:11 PM, David MacQuigg wrote: > What I would like to see is something like a simple "directive" I > could put in my Python code to say "The following function is in C", > and have Python set up the linkage for me. Actually, there is! It's part of scipy and it's *very* slick: http://www.scipy.org/Weave It works great, though as I said, for my problems it's not always faster than python+psyco+numpy (which I have to say I find disappointing, considering how cool weave is). > It would make a nice improvement in this Mandelbrot demo if you > could show me a way to significantly improve the speed of the Python > I already have, perhaps avoiding the need for C. I'll take a look at it. --- Rob Malouf Department of Linguistics and Asian/Middle Eastern Languages San Diego State University From bblais at bryant.edu Wed Mar 12 02:34:15 2008 From: bblais at bryant.edu (Brian Blais) Date: Tue, 11 Mar 2008 21:34:15 -0400 Subject: [Edu-sig] Introducing Python to Engineering Students In-Reply-To: <5.2.1.1.0.20080311170340.03959b10@mail.ece.arizona.edu> References: <5.2.1.1.0.20080311170340.03959b10@mail.ece.arizona.edu> Message-ID: <83AC3893-AE07-4F86-9270-A12F871FBA71@bryant.edu> On Mar 11, 2008, at Mar 11:8:11 PM, David MacQuigg wrote: > At 03:12 PM 3/11/2008 -0700, Rob Malouf wrote: > >> On Mar 11, 2008, at 2:57 PM, David MacQuigg wrote: >>> I guess what I should conclude is that when performance is >>> important, don't bother trying to optimize Python. Go straight to >>> C, and get 10 or 100X improvement. >> >> That hasn't always been my experience. I found that using psyco and >> numpy (along with careful profiling and optimization), I can often >> get >> essentially the same performance from pure Python that I can get from >> mixed Python/C solutions, and with much less trouble. > > I agree that the Python/C interface is more trouble than it should > be, especially for freshman engineering students and technical > professionals who don't have time for messy programming details. > What I would like to see is something like a simple "directive" I > could put in my Python code to say "The following function is in > C", and have Python set up the linkage for me. One of the things that drew me to Python for Numerical work was Pyrex (and now the Cython project). Here is your code in Pyrex (sans-doc string) def getpts(double cx0,double cy0,double dx): vals = [] cdef int p,i cdef double cx,zx,zy,zx2,zy2 for p from 0<=p<100: # 100 points cx = cx0 + p * dx # moving right x . . . . . . zx = zy = 0.0 for i from 0<=i<1000: # 100 points zx2 = zx*zx zy2 = zy*zy if (zx2 + zy2) > 4.0 : break # escape zy = 2*zx*zy + cy0 zx = zx2 - zy2 + cx vals.append(i) return vals This code gets compiled to C, and returns this unit test: Expected: 1a) Python speed = 787 points/sec 1b) C speed = 125500 points/sec 2a) Python speed = 823 points/sec 2b) C speed = 134300 points/sec Got: 1a) Python speed = 1214 points/sec 1b) C speed = 125700 points/sec 2a) Python speed = 1287 points/sec 2b) C speed = 134500 points/sec not too shabby! And for only putting the types of the variable into the existing python code, and a slight modification of the for-loop syntax, the conversion of a slow python function into a fast extension module is trivial. One of the best things here is that for debugging, you can put in arbitrary python code. You take the performance hit, but you don't care during debugging, and you take it out again for production. bb -- Brian Blais bblais at bryant.edu http://web.bryant.edu/~bblais -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/edu-sig/attachments/20080311/9bcb13a4/attachment.htm From rmalouf at mail.sdsu.edu Wed Mar 12 03:24:04 2008 From: rmalouf at mail.sdsu.edu (Rob Malouf) Date: Tue, 11 Mar 2008 19:24:04 -0700 Subject: [Edu-sig] Introducing Python to Engineering Students In-Reply-To: <5.2.1.1.0.20080311170340.03959b10@mail.ece.arizona.edu> References: <5.2.1.1.0.20080311170340.03959b10@mail.ece.arizona.edu> Message-ID: <3A87790E-F21E-428C-9D46-235E90386A30@mail.sdsu.edu> On Mar 11, 2008, at 5:11 PM, David MacQuigg wrote: > It would make a nice improvement in this Mandelbrot demo if you > could show me a way to significantly improve the speed of the Python > I already have, perhaps avoiding the need for C. Actually, I don't see a clean way to vectorize that inner loop, so maybe numpy isn't a good fit here. Which means weave is. First, running the program as-is, I get: 1a) Python speed = 776 points/sec 1b) C speed = 103200 points/sec 2a) Python speed = 833 points/sec 2b) C speed = 108600 points/sec With this added to the beginning of the program to load and invoke psyco: import psyco psyco.full() I get: 1a) Python speed = 2700 points/sec 1b) C speed = 101600 points/sec 2a) Python speed = 2800 points/sec 2b) C speed = 110100 points/sec Or, instead, replacing your getpts with the weave-d version: from numpy import zeros from scipy import weave ... vals = zeros(100,int) code = r""" double cx = cx0 - dx; for (int p=0; p<100; p++) { double zx = 0.0; double zy = 0.0; int i; cx += dx; for (i=0; i<999; i++) { double zx2 = zx*zx; double zy2 = zy*zy; if ((zx2 + zy2) > 4.0) break; zy = 2*zx*zy + cy0; zx = zx2 - zy2 + cx; } vals[p] = i; } """ weave.inline(code,['cx0','cy0','dx','vals']) I get: 1a) Python speed = 102200 points/sec 1b) C speed = 103300 points/sec 2a) Python speed = 108400 points/sec 2b) C speed = 110700 points/sec Not bad! There's probably a more pythonic way to write that, but this'll do. And after all, this is a realistic situation: you've got the inner loop of a program written in C, but you'd rather write all the supporting code around it in something like Python. And note that weave automatically compiles and links (if necessary) and then loads the C part when you run mandel.py. You (or your students) don't need to remember where the python headers are or how to build a shared library on whatever platform they're using. --- Rob Malouf Department of Linguistics and Asian/Middle Eastern Languages San Diego State University From rmalouf at mail.sdsu.edu Tue Mar 11 23:12:22 2008 From: rmalouf at mail.sdsu.edu (Rob Malouf) Date: Tue, 11 Mar 2008 15:12:22 -0700 Subject: [Edu-sig] Introducing Python to Engineering Students In-Reply-To: <5.2.1.1.0.20080311125543.03926900@mail.ece.arizona.edu> References: <5.2.1.1.0.20080310192814.00f03e70@pop.mail.yahoo.com> <5.2.1.1.0.20080310192814.00f03e70@pop.mail.yahoo.com> <5.2.1.1.0.20080311125543.03926900@mail.ece.arizona.edu> Message-ID: On Mar 11, 2008, at 2:57 PM, David MacQuigg wrote: > I guess what I should conclude is that when performance is > important, don't bother trying to optimize Python. Go straight to > C, and get 10 or 100X improvement. That hasn't always been my experience. I found that using psyco and numpy (along with careful profiling and optimization), I can often get essentially the same performance from pure Python that I can get from mixed Python/C solutions, and with much less trouble. --- Rob Malouf Department of Linguistics and Asian/Middle Eastern Languages San Diego State University From kirby.urner at gmail.com Wed Mar 12 04:14:48 2008 From: kirby.urner at gmail.com (kirby urner) Date: Tue, 11 Mar 2008 20:14:48 -0700 Subject: [Edu-sig] Introducing Python to Engineering Students In-Reply-To: <5.2.1.1.0.20080311125543.03926900@mail.ece.arizona.edu> References: <5.2.1.1.0.20080310192814.00f03e70@pop.mail.yahoo.com> <5.2.1.1.0.20080311125543.03926900@mail.ece.arizona.edu> Message-ID: On Tue, Mar 11, 2008 at 2:57 PM, David MacQuigg wrote: > Very nice!! I like the clear concise explanation of fractals. I'll add this link to whatever I put together. > > I like the way you construct the color palette, simple but effective. I'll have to play around with some more high-resolution images to see if I still get such nice colors. I see you have a link on creating palettes, but it is dead. Thank you sir. Link updated. > I'll modify my function to look more like yours, going for more clarity with only a small sacrifice in efficiency. I can't use the nice OOP style, however, because these students have studied only functions. OOP is an "advanced topic" covered in a later course for computer engineers, and not at all for electrical and other engineering majors. :( Yes, I understand your frustrations. I try to pitch to other faculty that "ontogeny *need not* recapitulate phylogeny" with the example of cell phones: you *don't* need to have used a land line first. Start early with objects. Some recent curriculum writing for a futuristic pre-college (still on the drawing board), explaining OO to math faculty: http://www.4dsolutions.net/presentations/tecc_oop.pdf http://www.4dsolutions.net/presentations/tecc_op_overloading.pdf Kirby from Portland Python Users Group (PPUG) CubeSpace, PDX From jjposner at snet.net Wed Mar 12 13:50:54 2008 From: jjposner at snet.net (John Posner) Date: Wed, 12 Mar 2008 08:50:54 -0400 Subject: [Edu-sig] Introducing Python to Engineering Students In-Reply-To: References: Message-ID: <002101c8843f$b5e24490$eb59a8c0@jposner> > > I'll modify my function to look more like yours, going for more > > clarity with only a small sacrifice in efficiency. I can't use the > > nice OOP style, however, because these students have studied only > > functions. OOP is an "advanced topic" covered in a later > course for > > computer engineers, and not at all for electrical and other > > engineering majors. :( > > Yes, I understand your frustrations. > > I try to pitch to other faculty that "ontogeny *need not* > recapitulate phylogeny" with the example of cell phones: > you *don't* need to have used a land line first. > > Start early with objects. > IMHO, object-oriented programming is like most technologies -- it was developed as a solution to perceived problems. Newbies, who haven't perceived the problems, will have trouble appreciating the solution. -John From kirby.urner at gmail.com Wed Mar 12 15:45:04 2008 From: kirby.urner at gmail.com (kirby urner) Date: Wed, 12 Mar 2008 07:45:04 -0700 Subject: [Edu-sig] Introducing Python to Engineering Students In-Reply-To: <002101c8843f$b5e24490$eb59a8c0@jposner> References: <002101c8843f$b5e24490$eb59a8c0@jposner> Message-ID: On Wed, Mar 12, 2008 at 5:50 AM, John Posner wrote: > IMHO, object-oriented programming is like most technologies -- it was > developed as a solution to perceived problems. Newbies, who haven't > perceived the problems, will have trouble appreciating the solution. > > -John Fortunately, in elementary mathematics, we have "types of object" (e.g. rational numbers) very amenable to object oriented treatment. There's no shortage of "objects" we might model (vectors, integers modulo N... polynomials). Python itself is also more understandable if you have a generic appreciation for "dot notation", which also gets us to a classes 'n objects discussion, i.e. what does dir('hello') really show us? The perceived problem, to which OO was (still is) a solution, is that procedural programming, even when structured, is too difficult, too awkward. Computer code should more closely mirror the the knowledge domain. And what knowledge domain has no objects? Hard to find, given we already think in terms of "things" and their relationships, their behaviors. I'm already doing Dog and Monkey classes on the first day, with 8th graders sometimes (adults other times). They get it. My belief is CS courses postpone classes 'n objects for a whole year because that's how an earlier generation of coder learned 'em i.e. late in the game. So these days they're considered "advanced" (and *there are* advanced aspects no question -- not saying everything OO is equally newbie accessible). I don't think it'll stay that way in every curriculum, especially those that tackle Python. Kirby From macquigg at ece.arizona.edu Wed Mar 12 16:20:25 2008 From: macquigg at ece.arizona.edu (David MacQuigg) Date: Wed, 12 Mar 2008 08:20:25 -0700 Subject: [Edu-sig] Introducing Python to Engineering Students In-Reply-To: <3A87790E-F21E-428C-9D46-235E90386A30@mail.sdsu.edu> References: <5.2.1.1.0.20080311170340.03959b10@mail.ece.arizona.edu> <5.2.1.1.0.20080311170340.03959b10@mail.ece.arizona.edu> Message-ID: <5.2.1.1.0.20080312080828.04349450@mail.ece.arizona.edu> At 07:24 PM 3/11/2008 -0700, Rob Malouf wrote: >On Mar 11, 2008, at 5:11 PM, David MacQuigg wrote: >>It would make a nice improvement in this Mandelbrot demo if you >>could show me a way to significantly improve the speed of the Python >>I already have, perhaps avoiding the need for C. >... >Or, instead, replacing your getpts with the weave-d version: > > from numpy import zeros > from scipy import weave > ... > vals = zeros(100,int) > > code = r""" > double cx = cx0 - dx; > for (int p=0; p<100; p++) { > double zx = 0.0; > double zy = 0.0; > int i; > cx += dx; > for (i=0; i<999; i++) { > double zx2 = zx*zx; > double zy2 = zy*zy; > if ((zx2 + zy2) > 4.0) break; > zy = 2*zx*zy + cy0; > zx = zx2 - zy2 + cx; > } > vals[p] = i; > } > """ > weave.inline(code,['cx0','cy0','dx','vals']) > >I get: > > 1a) Python speed = 102200 points/sec > 1b) C speed = 103300 points/sec > 2a) Python speed = 108400 points/sec > 2b) C speed = 110700 points/sec Excellent!!! This is exactly what we need. Our students will have no problem writing the C code string, and the Python wrappings are simple enough they can just follow this example verbatim. >There's probably a more pythonic way to write that, but >this'll do. And after all, this is a realistic situation: you've got >the inner loop of a program written in C, but you'd rather write all >the supporting code around it in something like Python. And note that >weave automatically compiles and links (if necessary) and then loads >the C part when you run mandel.py. You (or your students) don't need >to remember where the python headers are or how to build a shared >library on whatever platform they're using. That was my next problem. Our students use mostly Windows, some on MacOS, and a few on Linux. If all we need beyond the latest Python is numpy and scipy, that is great!! I'll have to experiment with this later. Many thanks. -- Dave From warren.sande at rogers.com Thu Mar 13 04:19:52 2008 From: warren.sande at rogers.com (Warren Sande) Date: Wed, 12 Mar 2008 20:19:52 -0700 (PDT) Subject: [Edu-sig] Introducing Python to Engineering Students Message-ID: <98486.56899.qm@web88104.mail.re2.yahoo.com> By the way, here is a non-OO version of a the fractals program that uses Pygame to display the output. Warren Sande #------------------------- # Simple fractal program using Pygame to display results # (Based on Kirby Urner's OO version) import pygame, sys palette = [(0,0,0)] def mkpalette(): global palette for i in range(0,255): palette.append((i*5%200 + 20, i*7%200 + 20, i*11%200 + 20)) return palette def compute_fractal(n, uleft_x, uleft_y, lright_x, lright_y): global pixels xwidth = lright_x - uleft_x ywidth = uleft_y - lright_y pixels = [] for x in range (500): pixel_row = [] for y in range (500): percentx = x/500.0 percenty = y/500.0 xp = uleft_x + percentx * xwidth yp = uleft_y - percenty * ywidth z = complex(xp,yp) o = complex(0,0) dotcolor = 0 for trials in range(n): if abs(o) <= 2.0: o = o**2 + z else: dotcolor = trials break pixel_row.append(palette[dotcolor]) pixels.append(pixel_row) mkpalette() pixels = [] print "computing fractal..." compute_fractal(64, -2, 1.25, 0.5, -1.25) print "done." screen = pygame.display.set_mode((500,500)) f_surf = pygame.Surface((500, 500)) for x in range(500): for y in range(500): f_surf.set_at((x, y), pixels[x][y]) screen.blit(f_surf, [0,0,500,500]) pygame.display.flip() while True: for event in pygame.event.get(): if event.type == pygame.QUIT: sys.exit() #------------------------- ----- Original Message ---- From: Warren Sande To: edu-sig at python.org Sent: Tuesday, March 11, 2008 12:20:02 AM Subject: Re: [Edu-sig] Introducing Python to Engineering Students David, For output graphics, you might want to have a look at Pygame. It is a wrapper for the SDL library. It has functionality for creating graphics windows, drawing, sprites, etc. But what might be of interest for you is the simple set_at(x,y) method, to set the color of individual pixels in a window. I have found the Pygame documentation to be pretty good. Here is a simple example of plotting a sinewave using set_at() #----------------------------- import pygame, sys, math screen = pygame.display.set_mode([640,480]) for x in range(0, 640): y = int(math.sin(x/640.0 * 4 * math.pi) * 200 + 240) screen.set_at([x, y],[255,0,0]) pygame.display.flip() while True: for event in pygame.event.get(): if event.type == pygame.QUIT: sys.exit() #------------------------------ Warren Sande ----- Original Message ---- From: David MacQuigg To: edu-sig at python.org Sent: Monday, March 10, 2008 10:28:21 PM Subject: [Edu-sig] Introducing Python to Engineering Students I've been asked to give an intro to Python for a freshman class with 150 students at University of Arizona. The class is taught in the Electrical and Computer Engineering Department, and is titled Computer Programming for Engineering Applications. The language is C (Hanly & Koffman, Problem Solving and Program Design in C). I think a nice way to do this will be an application where we can show the advantages of both languages - the computation of Mandelbrot images http://en.wikipedia.org/wiki/Mandelbrot_set. Python will provide the high-level "glue" which brings everything together in a nice programming environment, and C will provide the raw power for the loop that actually computes the pixels. My initial tests show this loop running about 100 times faster in C than in Python. The challenge is to do this without overwhelming the students. The plan is to make everything as simple as possible, just follow the instructions, except the loop itself, which the students will write in C, based on what I have written in Python. See http://ece.arizona.edu/~edatools/ece175/projects/mandelbrots/mbrotHW.html. Suggestions are welcome. Has anyone done something like this before? Can you improve on my code (I'm not a Python expert), or even suggest something entirely different? There is one major piece I would like to add to what I have so far - output graphics. This demo would really be cool if the students could see these glorious images appear on their screen instead of an array of numbers. I looked at the Python Imaging Library http://www.pythonware.com/products/pil/index.htm, and I don't see any examples that I can work from in converting an array of numbers into an image, just a lot of dense reference material that assumes I already know these image data formats. Maybe there is a simpler way. Help from someone with experience in Python graphics would be most appreciated. -- Dave _______________________________________________ Edu-sig mailing list Edu-sig at python.org http://mail.python.org/mailman/listinfo/edu-sig -----Inline Attachment Follows----- _______________________________________________ Edu-sig mailing list Edu-sig at python.org http://mail.python.org/mailman/listinfo/edu-sig -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/edu-sig/attachments/20080312/e9b99197/attachment.htm From macquigg at ece.arizona.edu Thu Mar 13 23:46:28 2008 From: macquigg at ece.arizona.edu (David MacQuigg) Date: Thu, 13 Mar 2008 15:46:28 -0700 Subject: [Edu-sig] Introducing Python to Engineering Students Message-ID: <5.2.1.1.0.20080313154620.02bf5c00@mail.ece.arizona.edu> At 01:16 PM 3/13/2008 -0700, Warren wrote: >David, > >There is a known problem with Pygame and IDLE. (Something about IDLE not running the program in a separate process.) If you just run the program form a command window, or use a different editor (like SPE) you wouldn't see that problem about closing the window. Well, it's probably not the TKinter "dueling event loops" problem. (PyGame doesn't use TKinter for its own event loop.) But I do see an FAQ at http://www.pygame.org/wiki/search.php?query=IDLE and the proposed solution is to make sure there is always a call to pygame.quit(). The example in the FAQ doesn't work, but I see what they are trying to do. Here is how I would write the final loop: while True: event = pygame.event.wait() if event.type == pygame.QUIT: break if event.type == pygame.MOUSEBUTTONDOWN: print "Enter new data" pygame.quit() Now there is no problem running from IDLE. >Changing the program so it updates as the calculation is ongoing is certainly possible. I'll play around with this some more. I'm very pleased with the documentation on PyGame. Without knowing anything about the program, I was able to find the functions and event types used in the snippet above. Many thanks for your help. -- Dave >----- Original Message ---- >From: David MacQuigg >To: Warren Sande >Sent: Thursday, March 13, 2008 2:51:00 PM >Subject: Re: [Edu-sig] Introducing Python to Engineering Students > >At 08:19 PM 3/12/2008 -0700, Warren Sande wrote: > >>By the way, here is a non-OO version of a the fractals program that uses Pygame to display the output. > >Very nice! I installed PyGame under Python25/Lib/site-packages, using the Windows installer from http://www.pygame.org/install.html, and ran the script below from my favorite IDE (IDLE). I wish Unix installs would go so smoothly. > >The only problem I noticed is that the CPU runs 100% and doesn't stop if you forget to click the X on the PyGame window. When I do click the X, the event loop stops, but he window remains. If I click the X again, I get Microsoft's "program is not responding" dialog, and its "please tell Microsoft" follow-on. There must be a better way to close this window. > >Also, it would be nice if we could show the window as it is being painted, and allow students to interrupt a long computation and try different coordinates. > >-- Dave > > >>#------------------------- >># Simple fractal program using Pygame to display results >># (Based on Kirby Urner's OO version) >>import pygame, sys >>palette = [(0,0,0)] >> >>def mkpalette(): >> global palette >> for i in range(0,255): >> palette.append((i*5%200 + 20, i*7%200 + 20, i*11%200 + 20)) >> return palette >> >>def compute_fractal(n, uleft_x, uleft_y, lright_x, lright_y): >> global pixels >> xwidth = lright_x - uleft_x >> ywidth = uleft_y - lright_y >> pixels = [] >> for x in range (500): >> pixel_row = [] >> for y in range (500): >> percentx = x/500.0 >> percenty = y/500.0 >> xp = uleft_x + percentx * xwidth >> yp = uleft_y - percenty * ywidth >> z = complex(xp,yp) >> o = complex(0,0) >> dotcolor = 0 >> for trials in range(n): >> if abs(o) <= 2.0: >> o = o**2 + z >> else: >> dotcolor = trials >> break >> pixel_row.append(palette[dotcolor]) >> pixels.append(pixel_row) >> >>mkpalette() >>pixels = [] >>print "computing fractal..." >>compute_fractal(64, -2, 1.25, 0.5, -1.25) >>print "done." >>screen = pygame.display.set_mode((500,500)) >>f_surf = pygame.Surface((500, 500)) >>for x in range(500): >> for y in range(500): >> f_surf.set_at((x, y), pixels[x][y]) >>screen.blit(f_surf, [0,0,500,500]) >>pygame.display.flip() >>while True: >> for event in pygame.event.get(): >> if event.type == pygame.QUIT: >> sys.exit() >>#------------------------- > > > >>----- Original Message ---- >>From: Warren Sande <warren.sande at rogers.com> >>To: edu-sig at python.org >>Sent: Tuesday, March 11, 2008 12:20:02 AM >>Subject: Re: [Edu-sig] Introducing Python to Engineering Students >> >>David, >> >>For output graphics, you might want to have a look at <http://www.pygame.org/>Pygame. It is a wrapper for the SDL library. It has functionality for creating graphics windows, drawing, sprites, etc. But what might be of interest for you is the simple set_at(x,y) method, to set the color of individual pixels in a window. >> >>I have found the Pygame documentation to be pretty good. >> >>Here is a simple example of plotting a sinewave using set_at() >> >>#----------------------------- >>import pygame, sys, math >>screen = pygame.display.set_mode([640,480]) >>for x in range(0, 640): >> y = int(math.sin(x/640.0 * 4 * math.pi) * 200 + 240) >> screen.set_at([x, y],[255,0,0]) >>pygame.display.flip() >>while True: >> for event in pygame.event.get(): >> if event.type == pygame.QUIT: >> sys.exit() >>#------------------------------ >> >>Warren Sande > > From macquigg at ece.arizona.edu Fri Mar 14 21:37:56 2008 From: macquigg at ece.arizona.edu (David MacQuigg) Date: Fri, 14 Mar 2008 13:37:56 -0700 Subject: [Edu-sig] Introducing Python to Engineering Students In-Reply-To: <3A87790E-F21E-428C-9D46-235E90386A30@mail.sdsu.edu> References: <5.2.1.1.0.20080311170340.03959b10@mail.ece.arizona.edu> <5.2.1.1.0.20080311170340.03959b10@mail.ece.arizona.edu> Message-ID: <5.2.1.1.0.20080314105523.02c023d0@mail.ece.arizona.edu> I got scipy.weave working in my Mandelbrot demo in Python2.5 under Cygwin, and the speed improvement is comparable to my hand-coded extension module. 1a) Python speed = 678 points/sec 1b) C speed = 115200 points/sec 169X 2a) Python speed = 721 points/sec 2b) C speed = 126400 points/sec 175X See http://ece.arizona.edu/~edatools/ece175/projects/mandelbrots/mandel_weave.py for the complete program, including both the Python and C-coded versions of the getpts function. It should run now in any Python setup with the required packages (numpy and weave). As Rob pointed out, this eliminates all the interface functions, the need to build a shared library for every little test, and the clutter in my site-packages directory from all these tests. Now, I can just tell the students "write your own C code, and put it in the stub function in this Python module." The stub function runs 10X faster than the C speed above, so we can be confident the Python overhead is negligible. At 09:30 PM 3/13/2008 -0700, Rob Malouf wrote: >Ugh! I'm afraid I don't use windows, so I can't offer any advice. I >do know that compiling scipy wasn't that difficult under linux or mac >os x, so it shouldn't be too bad under cygwin either. Weave and Numpy compiled without any snags, and that is all I need for now. > There are few >extra libraries you need, but you can probably find binaries for them >out there somewhere. In fact, I'm surprised there isn't a cygwin >binary for scipy... if you get it working maybe you should post it >somewhere! Or at least some instructions that are more clear on building such a binary. Many thanks for all the help. -- Dave At 07:24 PM 3/11/2008 -0700, Rob Malouf wrote: >On Mar 11, 2008, at 5:11 PM, David MacQuigg wrote: >>It would make a nice improvement in this Mandelbrot demo if you >>could show me a way to significantly improve the speed of the Python >>I already have, perhaps avoiding the need for C. > >Actually, I don't see a clean way to vectorize that inner loop, so >maybe numpy isn't a good fit here. Which means weave is. > >First, running the program as-is, I get: > > 1a) Python speed = 776 points/sec > 1b) C speed = 103200 points/sec > 2a) Python speed = 833 points/sec > 2b) C speed = 108600 points/sec > >With this added to the beginning of the program to load and invoke >psyco: > > import psyco > psyco.full() > >I get: > > 1a) Python speed = 2700 points/sec > 1b) C speed = 101600 points/sec > 2a) Python speed = 2800 points/sec > 2b) C speed = 110100 points/sec > >Or, instead, replacing your getpts with the weave-d version: > > from numpy import zeros > from scipy import weave > ... > vals = zeros(100,int) > > code = r""" > double cx = cx0 - dx; > for (int p=0; p<100; p++) { > double zx = 0.0; > double zy = 0.0; > int i; > cx += dx; > for (i=0; i<999; i++) { > double zx2 = zx*zx; > double zy2 = zy*zy; > if ((zx2 + zy2) > 4.0) break; > zy = 2*zx*zy + cy0; > zx = zx2 - zy2 + cx; > } > vals[p] = i; > } > """ > weave.inline(code,['cx0','cy0','dx','vals']) > >I get: > > 1a) Python speed = 102200 points/sec > 1b) C speed = 103300 points/sec > 2a) Python speed = 108400 points/sec > 2b) C speed = 110700 points/sec > >Not bad! There's probably a more pythonic way to write that, but >this'll do. And after all, this is a realistic situation: you've got >the inner loop of a program written in C, but you'd rather write all >the supporting code around it in something like Python. And note that >weave automatically compiles and links (if necessary) and then loads >the C part when you run mandel.py. You (or your students) don't need >to remember where the python headers are or how to build a shared >library on whatever platform they're using. > >--- >Rob Malouf >Department of Linguistics and Asian/Middle Eastern Languages >San Diego State University From gregor.lingl at aon.at Sat Mar 15 04:14:55 2008 From: gregor.lingl at aon.at (Gregor Lingl) Date: Sat, 15 Mar 2008 04:14:55 +0100 Subject: [Edu-sig] xturtle - new version Message-ID: <47DB3F2F.6000504@aon.at> Hi everyone ... I've been off line for a while, due to a lot of work ... ... but since approx. two weeks I've found time to continue my work on xturtle.py and to implement a few hopfully useful features as well as some example scripts demonstrating them. Only one of them I'd like to mention here, because it proved really very useful for interactive work with turtle graphics: an undo() method/function, which serves to correct painlessly the consequences of wrong ideas ;-) Notes on the new features are in a text file in the xturtle package as well as here: http://www.rg16.at/~python/xturtle/whatsnew.txt You can download the zipped package with xturtle.py, a demoviewer and the sample scripts from the (still not substantially refreshed) website: http://www.rg16.at/~python/xturtle/download.html Quite a few users asked and/or encouraged me during the last months to anew propose xturtle.py as a replacement or a supplement for xturtle.py either for Python 2.6 and especially for Python 3000. (A port of xturtle.py to Python3000 is under way and nearly ready!) Morover there is the following point in PEP-0361, the Python 2.6 and 3.0 release schedule: - turtle.py replacement or enhancements I'll propose my workto the developer community within a short time. The code of the current version works well, albeit it certainly still has some bugs. (I hope to get bug reports form users ....) I plan to polish the code during the next weeks. For now I think, that the current version can serve well as a basis for a discussion about the following topics: 1) about the API - i. e. about the naming of the classes and methods as well as about the question if there are some which could be eliminated or other new features which should be added. (Imho I've reached a point where it seems not to be reasonable to add substantially more features) 2) about the question if xturtle should be compatible to turtle.py as far as possible, in the sense that turtle-programs should run with xturtle in the same way. (I think this is to a far extent the case now - but it complicates and extends the code of xturtle considerably.) Of course many users as well as nonusers of turtle graphics have a lot of different opinions about it's advantages and disadvantages.I'd just like to mention once more, the for me it is a very valuable instrument to visualize computer science concepts easily and consequently to teach programming. To see better what I mean with this, please have a look at the code of the minimal_hanoi.py sample script, which implements a graphical animation of the tower of hanoi game using a lot of advanced concepts of Python but nearly without any overhead for graphics operations. That's just my approach to using turtle graphics. So I'd like to modestly ask you to have a look at the xturtle package, think about it's usefulness for educational purposes and give some feedback or contribute otherwise to the discussion. With kind regards, Gregor From horst.jens at chello.at Sat Mar 15 07:38:22 2008 From: horst.jens at chello.at (Horst JENS) Date: Sat, 15 Mar 2008 07:38:22 +0100 Subject: [Edu-sig] xturtle - new version In-Reply-To: <47DB3F2F.6000504@aon.at> References: <47DB3F2F.6000504@aon.at> Message-ID: <1205563103.6211.6.camel@horst-laptop> Viva xturtle ! The new version comes just in time, i'm uploading a lot of xturtle videos to www.showmedo.com this weekend. Any news about making xturtle an official package for python 2.6 ? -Horst -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: Dies ist ein digital signierter Nachrichtenteil Url : http://mail.python.org/pipermail/edu-sig/attachments/20080315/ab6b893a/attachment.pgp From kirby.urner at gmail.com Sun Mar 16 22:21:20 2008 From: kirby.urner at gmail.com (kirby urner) Date: Sun, 16 Mar 2008 16:21:20 -0500 Subject: [Edu-sig] Kirby from Pycon Message-ID: Greetings from Pycon. I've mentioned this list to numerous people at this conference. As I said over dinner (hotel buffet), I think we have enough talent around this table to bring off the revolution (OK, a little short on details -- probably why we all seemed to agree). As we disperse, I encourage those of us already here (at the conference and on this list) to keep reaching out to the contacts we've made. Lots of cool cosmic fish will slip through our nets if we don't (as some will even if we do -- such is life). My two Pycon blog posts (so far): http://worldgame.blogspot.com/2008/03/pycon-2008.html http://controlroom.blogspot.com/2008/03/more-from-pycon.html More later, Kirby From gregor.lingl at aon.at Sun Mar 16 22:41:36 2008 From: gregor.lingl at aon.at (Gregor Lingl) Date: Sun, 16 Mar 2008 22:41:36 +0100 Subject: [Edu-sig] Kirby from Pycon In-Reply-To: References: Message-ID: <47DD9410.2000906@aon.at> kirby urner schrieb: > Greetings from Pycon. > > I've mentioned this list to numerous people at this > conference. As I said over dinner (hotel buffet), > I think we have enough talent around this table > to bring off the revolution (OK, a little short on > details -- probably why we all seemed to agree). > > As we disperse, I encourage those of us already > here (at the conference and on this list) to keep > reaching out to the contacts we've made. Lots > of cool cosmic fish will slip through our nets if we > don't (as some will even if we do -- such is life). > > Hi Kirby, what do you think about xturtle? Is it cool? Cosmic? A fish ;-) Will it slip through our nets? I read your blog entries and regret not to have been there. It was impossible for me this year, but I consider to manage to attend PyCon 2009, (if some financial support would be possible from somewhere ;) ) Let's see. Looking forward to more from you, later Gregor > My two Pycon blog posts (so far): > http://worldgame.blogspot.com/2008/03/pycon-2008.html > http://controlroom.blogspot.com/2008/03/more-from-pycon.html > > More later, > > Kirby > _______________________________________________ > Edu-sig mailing list > Edu-sig at python.org > http://mail.python.org/mailman/listinfo/edu-sig > > > From lac at openend.se Sun Mar 16 23:06:37 2008 From: lac at openend.se (Laura Creighton) Date: Sun, 16 Mar 2008 23:06:37 +0100 Subject: [Edu-sig] Kirby from Pycon In-Reply-To: Message from Gregor Lingl of "Sun, 16 Mar 2008 22:41:36 +0100." <47DD9410.2000906@aon.at> References: <47DD9410.2000906@aon.at> Message-ID: <200803162206.m2GM6bWu015392@theraft.openend.se> In a message of Sun, 16 Mar 2008 22:41:36 +0100, Gregor Lingl writes: >kirby urner schrieb: >> Greetings from Pycon. >> >> I've mentioned this list to numerous people at this >> conference. As I said over dinner (hotel buffet), >> I think we have enough talent around this table >> to bring off the revolution (OK, a little short on >> details -- probably why we all seemed to agree). >> >> As we disperse, I encourage those of us already >> here (at the conference and on this list) to keep >> reaching out to the contacts we've made. Lots >> of cool cosmic fish will slip through our nets if we >> don't (as some will even if we do -- such is life). >> >> >Hi Kirby, > >what do you think about xturtle? Is it cool? Cosmic? A fish ;-) >Will it slip through our nets? > >I read your blog entries and regret not to have been there. It was >impossible for me this year, but I consider to manage to attend >PyCon 2009, (if some financial support would be possible from >somewhere ;) ) Let's see. > >Looking forward to more from you, later > >Gregor The PSF provided financial aid to attend pycon this year and intends to keep on doing this. Laura From kirby.urner at gmail.com Mon Mar 17 21:02:09 2008 From: kirby.urner at gmail.com (kirby urner) Date: Mon, 17 Mar 2008 15:02:09 -0500 Subject: [Edu-sig] Kirby from Pycon In-Reply-To: <47DD9410.2000906@aon.at> References: <47DD9410.2000906@aon.at> Message-ID: > Hi Kirby, > > what do you think about xturtle? Is it cool? Cosmic? A fish ;-) > Will it slip through our nets? > I admire and respect your work Gregor, think of you as a generous and intelligent guy. I hope to meet you one day. I don't do a lot of turtles myself these days, but there's a huge literature, many seriously mathematical yet playful things to do with them. They're not "just spirographs" (although they're good for that too). The one time I started down the turtle graphics road in my own curriculum writing was in connnection with the so-called Lturtle or L-system turtle: http://www.4dsolutions.net/ocn/numeracy3.html > I read your blog entries and regret not to have been there. It was > impossible for me this year, but I consider to manage to attend > PyCon 2009, (if some financial support would be possible from > somewhere ;) ) Let's see. > > Looking forward to more from you, later > > Gregor Likewise, Kirby From gregor.lingl at aon.at Mon Mar 17 21:22:02 2008 From: gregor.lingl at aon.at (Gregor Lingl) Date: Mon, 17 Mar 2008 21:22:02 +0100 Subject: [Edu-sig] Kirby from Pycon In-Reply-To: References: <47DD9410.2000906@aon.at> Message-ID: <47DED2EA.9080005@aon.at> Hi Kirby, > ... > I admire and respect your work Gregor, think of you as a generous > and intelligent guy. I hope to meet you one day. > > I certainly would enjoy that. > ... > > The one time I started down the turtle graphics road in my own > curriculum writing was in connnection with the so-called Lturtle > or L-system turtle: http://www.4dsolutions.net/ocn/numeracy3.html > > My xturtle package http://www.rg16.at/~python/xturtle/download.html contains a demoViewer and a set of 30+ demoscripts, among them two Lindenmayer examples (of course only twodimensional). One of them lets two (different) plants grow in parallel (using generators): http://www.rg16.at/~python/xturtle/code/xtx_lindenmayer/xtx_twoPlants.py The other one, more simple, is an example from ethno mathematics. I'm sure you would enjoy it if you had the time to view it. Regards, Gregor >> I read your blog entries and regret not to have been there. It was >> impossible for me this year, but I consider to manage to attend >> PyCon 2009, (if some financial support would be possible from >> somewhere ;) ) Let's see. >> >> Looking forward to more from you, later >> >> Gregor >> > > Likewise, > > Kirby > > > From gregor.lingl at aon.at Tue Mar 18 01:57:23 2008 From: gregor.lingl at aon.at (Gregor Lingl) Date: Tue, 18 Mar 2008 01:57:23 +0100 Subject: [Edu-sig] Kirby from Pycon In-Reply-To: References: <47DD9410.2000906@aon.at> <47DED2EA.9080005@aon.at> Message-ID: <47DF1373.1070606@aon.at> Richard Guenther schrieb: > Hi Gregor (and Kirby), > > I've been silent for a while on this list, as I've been in the process > of changing email accounts, installing various Linux distros, and my > full-time job.... > > I teach high school students in Colorado, US. I have downloaded > Xturtle and some of my students and I have played with each example. > I will show it to my programming club this week. > > I like what I see so far. I do use the regular turtle module, but > most of my students want to leave it behind and switch to pygame after > a little while. Xturtle has some advantages. > > The xturtleDemo.py file runs quite well on Ubuntu Linux, except for > the moorhuhn game, which uses the winsound module. I have not tested > any of this on Windows, but will do so soon. Thanks for the feedback, Richard. Perhaps you could create a Linux version of moorhuhn game with some (to winsound equivalent module? If necessary, from pygame? Do you know the original moorhuhn game? If so, you certainly can tell me the original English name of the game. (I know, that the English word for Moorhuhn is grouse - but is this the name of the game?) All the best Gregor P.S.: Another interesting question is, if Guenther is an English name. In fact in German it's frequently used as a first name (as well as Richard). > Thanks, > > Richard Guenther > From david at boddie.org.uk Tue Mar 18 02:06:25 2008 From: david at boddie.org.uk (David Boddie) Date: Tue, 18 Mar 2008 02:06:25 +0100 Subject: [Edu-sig] EuroPython 2008 - Any interest in tutorials? Message-ID: <200803180206.25936.david@boddie.org.uk> [I hope this isn't regarded as off-topic for this list - please consider it a sincere attempt to gather input rather than a shameless attempt at marketing. ;-)] As many of you may be aware, preparations for EuroPython 2008 - the European Python community conference - are under way. For the second year running, the event will be held in Vilnius, Lithuania, with the main programme taking place on Monday 7th, Tuesday 8th and Wednesday 9th July. Those of us involved with the conference are looking for ways in which we can make the event more interesting for beginners and experts alike. One way in which we could do this, particularly for people who are learning Python, is to allocate time for tutorials. This approach appears to be popular at conferences like PyCon and PyCon UK, but isn't something we normally do at EuroPython, though there are often talks are aimed at beginners in the schedule. What we'd like to know is: * Is this something that you would like to see? * Would you be interested in giving a tutorial? * Which subject would you be interested in hearing/talking about? If you answered "yes" to either of the first two questions, please feel free to add suggestions for tutorials, either as a participant or as a speaker, to this page on the EuroPython Wiki: http://www.europython.org/community/Talk_Suggestions If you're interested in participating in EuroPython this year in any way, please come and join us on the europython mailing list http://mail.python.org/mailman/listinfo/europython or visit this page on the EuroPython Web site: http://www.europython.org/community/Participants Hope to see some of you there! David Boddie - EuroPython 2008 participant :-) From lavendula6654 at yahoo.com Tue Mar 18 02:44:39 2008 From: lavendula6654 at yahoo.com (Elaine) Date: Mon, 17 Mar 2008 18:44:39 -0700 (PDT) Subject: [Edu-sig] Foothill College Spring Courses Message-ID: <113433.47721.qm@web31703.mail.mud.yahoo.com> Spring quarter classes start Monday, 7 April, at Foothill College. These two may be of interest to you: 1) Introduction to Python Programming - 5 units Prerequisite: Any programming language experience CIS 68K - Monday evenings at Middlefield campus in Palo Alto 2) Application Software Development with Ajax - 5 units Prerequisite: Knowledge of HTML and JavaScript COIN 71 - Tuesday evenings at Middlefield campus in Palo Alto If you are interested in taking a class, please register as soon as possible by going to: http://www.foothill.fhda.edu/reg/index.php If not enough students sign up, a class may be cancelled. If you have any questions, please contact the instructor, Elaine Haight, at haightElaine at foothill.edu ____________________________________________________________________________________ Looking for last minute shopping deals? Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsearch/category.php?category=shopping From kirby.urner at gmail.com Tue Mar 18 19:22:05 2008 From: kirby.urner at gmail.com (kirby urner) Date: Tue, 18 Mar 2008 13:22:05 -0500 Subject: [Edu-sig] Kirby from Pycon In-Reply-To: <47DED2EA.9080005@aon.at> References: <47DD9410.2000906@aon.at> <47DED2EA.9080005@aon.at> Message-ID: > My xturtle package > > http://www.rg16.at/~python/xturtle/download.html > I've downloaded it and started playing around. My habit is to already be in a shell, such as IDLE, and access everything by importing, like this: IDLE 1.2.1 >>> import xturtle # changed folder name xturtle0.95a0 - bugfixes: 1 No config file! >>> from xturtle import xturtle >>> dir(xturtle) ['Pen', 'RawPen', 'RawTurtle', 'ScrolledCanvas', ... etc. >>> theturtle = xturtle.Turtle() >>> theturtle.forward(10) >>> theturtle.rotate(90) etc. This works well so far, after I install your directory and subdirectories under site-packages (where I expect all 3rd party tools), then add an __init__.py file so it works as a package. I haven't yet gotten the demo viewer to work by importing it interactively -- working on it. In my own classroom, I don't like to run Python modules from bash or other non-Python command line, nor do I enjoy hitting F5 or some other key to make them run (annoying when VPython would mess with the default startup config, and take me to IDLE's text editor upon booting IDLE -- I always set it back to normal). I like to start in some interactive Python shell and import to enrich my local namespace, picking and choosing which top-level classes and functions, using Python as a calulator. Of course this isn't always possible with IDLE, given Tk mainloop contention issues (but is how the old turtle.py works, and so far xturtle.py as well, which I like. Kirby From kirby.urner at gmail.com Tue Mar 18 19:51:39 2008 From: kirby.urner at gmail.com (kirby urner) Date: Tue, 18 Mar 2008 13:51:39 -0500 Subject: [Edu-sig] More Pycon threads... Message-ID: I've uploaded a few Pycon2008 pix to a public Flickr folder for the curious (of course many others have done the same): http://flickr.com/photos/17157315 at N00/sets/72157604146122293/ Maybe a little misleading to show that Hyatt, which I took for the gorgeous reflected lighting -- we actually were at the Crowne Plaza nearby. If anyone knows the name of the gentleman on the left in 00057 looking at the XO, I'd be much obliged. He taught at Saturday Academy (where I teach) many years ago, while working at Intel. We had a lot of good conversation but I forgot his name. The man on the right is Patrick O'Brien, whom I suspect most of us would know from PyShell and PyCrust, part of the wxPython package. He's also the architect of Schevo, a cutting edge Object Oriented Database which he uses behind the scenes on the job. Yes, that's whiskey in our cups (Bushmills, provided by yours truly). 00063 deserves an explanation. That's the ceiling of the atrium, the big common area outside the ballrooms and above the small rooms where we had the BOFs. This is a common spaceframe in today's architecture, known as the octet-truss, for which Bucky Fuller gained a patent (long since expired). It links to my talk in the sense that balls piled up in a tetrahedron or half-octahedron make this same pattern (if you interconnect adjacent ball centers with rods). Ball packing, triangular and tetrahedral numbers, are important topics in my classroom.** As for that talk, Ian Benson of sociality.tv is very involved in the workflow by which raw video of speaker talks is transcoded to digital and made available. He chose mine as a way of demoing his trademark post production process and hopes to have something viewable in the not too distant future. I'll post a link when one becomes available. Ian knows a huge amount about the pedagogy of working with young children since Piaget and Papert, the many forks in that road. I'm learning a lot from the guy. He spearheads an algebraFirst initiative, which helps kids develop their intuitions around abstract algebra even before they learn the standard arithmetical algorithms, normally considered a starting place. You'll see a book he was sharing prominently featured in those same Pycon pix (Patrick is holding my copy). 00060 is a picture of Ed Leafe, the man behind Dabo, a Pythonic implementation of an xBase-like database development framework ala FoxPro (another subculture I work in). I also had some quality time talking with Jonah, who has an enviable position within the Columbia University namespace. He claims to lurk on this list. Hi Jonah! Kirby in west Pennsylvania Cc: Ian ** http://www.grunch.net/synergetics/octet.html http://www.4dsolutions.net/presentations/sa_8620.pdf (note: Alexander Graham Bell was deeply into this same truss -- something Bucky Fuller didn't know until later (all important history in my math classroom)). From macquigg at ece.arizona.edu Wed Mar 19 21:53:23 2008 From: macquigg at ece.arizona.edu (David MacQuigg) Date: Wed, 19 Mar 2008 13:53:23 -0700 Subject: [Edu-sig] Introducing Python to Engineering Students In-Reply-To: References: <5.2.1.1.0.20080312161322.02c1daf0@mail.ece.arizona.edu> <5.2.1.1.0.20080311170340.03959b10@mail.ece.arizona.edu> <5.2.1.1.0.20080311170340.03959b10@mail.ece.arizona.edu> <5.2.1.1.0.20080312161322.02c1daf0@mail.ece.arizona.edu> Message-ID: <5.2.1.1.0.20080319113343.02b03ec0@mail.ece.arizona.edu> Our mandelbrot demo is working nicely, thanks to all the help I've gotten from folks on this list. We are using only the weave package, not the full SciPy install. It would be nice to show some additional examples from SciPy, however, especially tools that students will find useful in later classes. The problem is I'm not sure SciPy is ready for prime time in the undergraduate curriculum. It will look bad if this package is not as good as Matlab, which is what the students at U of A are using in many of their other courses. I would like to get some opinions on this issue from others who may have been here before. Here are my experiences so far in getting started with SciPy, trying to run it as I expect our students would, on their own machines rather than the department's Solaris machines. 1) I'm using a Windows XP machine, similar to what most of the students are using, so anything we want them to install on their own computers must work under Windows, or at least under Cygwin. Most students don't have Cygwin installed, but we can consider that as part of the package if we decide to go that route. Cygwin adds benefits beyond SciPy, of course, but disk space may be an issue. 2) I tried a direct install under Windows using the installers from http://www.scipy.org/Download NumPy 1.0.4 for Python 2.5 - numpy-1.0.4.win32-py2.5.msi SciPy 0.6.0 for Python 2.5 - scipy-0.6.0.win32-py2.5.exe The installs ran without error, but when I tried running the test scripts from each of these packages under Python 2.5, all I got was the useless "tell Microsoft" window. >>> import numpy, scipy >>> numpy.test() python.exe has encountered a problem .. please tell Microsoft ... >>> scipy.test() python.exe has encountered a problem .. please tell Microsoft ... I guess the problem is that I have not installed Microsoft's C-compiler, but neither the installers nor the test scripts tell me that. There does not seem to be any un-install utility, so I will just delete numpy/ and scipy/ from C://Python25/Lib/site-packages/ and hope that no problems remain from registry entries, egg-info files, and other gradoo left by the installers! 3) I then tried installing under Cygwin, following the incomplete instructions at http://scipy.org/Installing_SciPy/Windows from http://www.scipy.org/Download NumPy 1.0.4 - numpy-1.0.4.tar.gz SciPy 0.6.0 - scipy-0.6.0.tar.gz 3a) The numpy install and test ran without error. $ pwd /packages/Python-2.5/numpy-1.0.4 $ python setup.py install .... $ python -c 'import numpy; numpy.test()' .... Ran 692 tests in 1.593s OK 3b) The scipy install hit some snags, however, ending in a corruption of Cygwin that could only be fixed with a full reboot. $ python setup.py install --> NOT AVAILABLE: mkl, fftw3, rfftw, drfftw, ptf77blas, f77blas, ... Restarted cygwin bash shell: 13283 [main] ? (5388) C:\cygwin\bin\bash.exe: *** fatal error - system shared memory version mismatch detected - 0x75BE009C/0x8A88009C. This problem is probably due to using incompatible versions of the cygwin DLL. Search for cygwin1.dll using the Windows Start->Find/Search facility and delete all but the most recent version. The most recent version *should* reside in x:\cygwin\bin, where 'x' is the drive on which you have installed the cygwin distribution. Rebooting is also suggested if you are unable to find another cygwin DLL. 4) I then installed just the weave package from scipy, and except for a few warnings during the test run, it seems to be OK. 5) I did a google search on [scipy install] and found others having similar problems over the years. One fellow had success with the installer at http://www.enthought.com/products/epdacademic.php. I downloaded that one and ran it, a process which took several hours and created a Python25 directory with 719MB and 38814 files!!! sys.path is now crammed with 116 really messy paths. Luckily, I kept all this separate from my normal Python install. 6) I tried testing the new install. Numpy passed all tests, and SciPy got a little further, but ended with a crash. The error messages, as usual, mean nothing. .... vq.py:477: UserWarning: One of the clusters is empty. Re-run kmean with a different initialization. Running tests: ........................... crash - "python.exe has encountered a problem and needs to close ..." 7) I tried running the SciPy tutorial at http://www.scipy.org/SciPy_Tutorial in hopes that whatever failed was in some obscure function I won't need. No such luck. 2 out of 4 of the tutorials crashed Python. Basic Matrix Operations - OK Sparse Matrices - OK Numerical Integration - function quad crashes Python Integrating ODEs - function odeint crashes Python I see that Enthought has a nicely organized webpage, including a http://www.scipy.org/Developer_Zone where they are asking for help with packaging. The two environments most used by our students (PC and Macintosh) have nobody volunteering to do the packaging. What I can't tell from just a few days investigation is where is SciPy heading? Will things be working smoothly soon, or is it being eclipsed by Matlab? I've worked on both open-source and commercial projects, and I know there are some project that just don't fit one or the other model. Open-source is best when you have millions of users and thousands of potential developers. Commercial is best when there are fewer users, and those users are not typically computer experts. Thoughts anyone? -- Dave At 09:30 PM 3/13/2008 -0700, Rob Malouf wrote: >Ugh! I'm afraid I don't use windows, so I can't offer any advice. I >do know that compiling scipy wasn't that difficult under linux or mac >os x, so it shouldn't be too bad under cygwin either. There are few >extra libraries you need, but you can probably find binaries for them >out there somewhere. In fact, I'm surprised there isn't a cygwin >binary for scipy... if you get it working maybe you should post it >somewhere! From stef.mientki at gmail.com Thu Mar 20 01:41:54 2008 From: stef.mientki at gmail.com (Stef Mientki) Date: Thu, 20 Mar 2008 01:41:54 +0100 Subject: [Edu-sig] Introducing Python to Engineering Students In-Reply-To: <5.2.1.1.0.20080319113343.02b03ec0@mail.ece.arizona.edu> References: <5.2.1.1.0.20080312161322.02c1daf0@mail.ece.arizona.edu> <5.2.1.1.0.20080311170340.03959b10@mail.ece.arizona.edu> <5.2.1.1.0.20080311170340.03959b10@mail.ece.arizona.edu> <5.2.1.1.0.20080312161322.02c1daf0@mail.ece.arizona.edu> <5.2.1.1.0.20080319113343.02b03ec0@mail.ece.arizona.edu> Message-ID: <47E1B2D2.4020102@gmail.com> hi David, David MacQuigg wrote: > Our mandelbrot demo is working nicely, thanks to all the help I've gotten from folks on this list. We are using only the weave package, not the full SciPy install. It would be nice to show some additional examples from SciPy, however, especially tools that students will find useful in later classes. > > The problem is I'm not sure SciPy is ready for prime time in the undergraduate curriculum. It will look bad if this package is not as good as Matlab, which is what the students at U of A are using in many of their other courses. I would like to get some opinions on this issue from others who may have been here before. > > Here are my experiences so far in getting started with SciPy, trying to run it as I expect our students would, on their own machines rather than the department's Solaris machines. > > 1) I'm using a Windows XP machine, similar to what most of the students are using, so anything we want them to install on their own computers must work under Windows, or at least under Cygwin. Most students don't have Cygwin installed, but we can consider that as part of the package if we decide to go that route. Cygwin adds benefits beyond SciPy, of course, but disk space may be an issue. > > I started about a year ago with the Enthought edition http://code.enthought.com/enthon/ under windows-XP, 4 machines some SP1, some SP2, used embedded in Delphi, as a direct replacement for embedded Matlab, everything worked like a charm. In fact everything worked so well, that about 3 months ago, I decided to make a pure Python (open source) LabView equivalent with it (should be released in a couple of weeks). In the meanwhile I also tried to update Scipy, but Enthought switched to the eggs-philosophy, which seems to be a big disaster to me ( so I rolled everything back to the orginal Entought suite). I think if you send this message to the Scipy list, you get an answer of Robert Kern himself within half an hour (if he is awake ;-) cheers, Stef Mientki From enbody at cse.msu.edu Thu Mar 20 16:31:33 2008 From: enbody at cse.msu.edu (Richard Enbody) Date: Thu, 20 Mar 2008 11:31:33 -0400 Subject: [Edu-sig] introduction Message-ID: <47E28355.2030809@cse.msu.edu> Greetings. I'm a professor in Computer Science and Engineering at Michigan State University, and we started using Python last fall (2007) in our first programming course for majors (CS and CpE), i.e. a 'CS1' course. However, more than half the students are non-majors. The URL is http://www.cse.msu.edu/~cse231 MSU is a large, midwestern US university (40K students). Our CS1 course has two lecture sections of slightly over a hundred students each with a scheduled ('closed') weekly lab. I'm looking forward to interacting with you all (and I'm embarrassed that it took me so long to find this list). Cheers. -rich enbody at cse.msu.edu From macquigg at ece.arizona.edu Thu Mar 20 19:27:33 2008 From: macquigg at ece.arizona.edu (David MacQuigg) Date: Thu, 20 Mar 2008 11:27:33 -0700 Subject: [Edu-sig] introduction In-Reply-To: <47E28355.2030809@cse.msu.edu> Message-ID: <5.2.1.1.0.20080320102906.03f99510@mail.ece.arizona.edu> Rich, Hello, and thanks for joining the edu-sig list. I'm a PhD electrical engineer with a recently re-ignited interest in computer science, largely due to my discovery of Python in 2002. I'm also "volunteer staff" at U of A, helping teach various courses. I'm especially interested in your experiences, good and bad, introducing Python in a university curriculum. Here are a few questions to start. 1) I see the course is 200-level. Is it mostly sophomores, or some more ambitious freshmen? When you say "non-majors" are you talking business types, or engineering, math and science? 2) I don't see any pre-requisites. Surely the students at this level have some prior programming experience. What are you seeing as typical? Are the bright guys bored, and the rest overwhelmed? 3) What are the expected follow-on courses, e.g. Java for CIS majors, C for EE's, advanced courses in OOP, embedded systems, etc.? 4) Will the students continue to use Python in later classes, or is it too early to tell? Is Python expected to supplement or replace Matlab? 5) What computing environments do the students use in this and later courses (Windows, MacOS, or remote to the departmental computer)? I look forward to seeing your book. -- Dave At 11:31 AM 3/20/2008 -0400, Richard Enbody wrote: >Greetings. > >I'm a professor in Computer Science and Engineering at Michigan State >University, and we started using Python last fall (2007) in our first >programming course for majors (CS and CpE), i.e. a 'CS1' course. >However, more than half the students are non-majors. The URL is >http://www.cse.msu.edu/~cse231 > >MSU is a large, midwestern US university (40K students). Our CS1 course >has two lecture sections of slightly over a hundred students each with a >scheduled ('closed') weekly lab. > >I'm looking forward to interacting with you all (and I'm embarrassed >that it took me so long to find this list). > >Cheers. > >-rich >enbody at cse.msu.edu From annaraven at gmail.com Thu Mar 20 21:08:44 2008 From: annaraven at gmail.com (Anna Ravenscroft) Date: Thu, 20 Mar 2008 13:08:44 -0700 Subject: [Edu-sig] introduction In-Reply-To: <47E28355.2030809@cse.msu.edu> References: <47E28355.2030809@cse.msu.edu> Message-ID: On Thu, Mar 20, 2008 at 8:31 AM, Richard Enbody wrote: > Greetings. > > I'm a professor in Computer Science and Engineering at Michigan State > University, and we started using Python last fall (2007) in our first > programming course for majors (CS and CpE), i.e. a 'CS1' course. > However, more than half the students are non-majors. The URL is > http://www.cse.msu.edu/~cse231 > The syllabus looks interesting. I notice your emphasis on not allowing others to "look at" a student's solution. Given that most coding these days involves teamwork, pair programming, or at least, code reviews, are you considering any pair-programming or small team projects in future iterations of the class? I believe some universities have moved toward incorporating some team or partner projects to help overcome the "loner" stereotype of programmers, and draw more women and other populations to the major. > I'm looking forward to interacting with you all (and I'm embarrassed > that it took me so long to find this list). Welcome! Perhaps we'll meet you at PyCon next year? (It'll be in Chicago again next spring.) -- cordially, Anna -- Walking through the water. Trying to get across. Just like everybody else. From enbody at cse.msu.edu Thu Mar 20 21:38:44 2008 From: enbody at cse.msu.edu (Richard Enbody) Date: Thu, 20 Mar 2008 16:38:44 -0400 Subject: [Edu-sig] introduction In-Reply-To: References: <47E28355.2030809@cse.msu.edu> Message-ID: <47E2CB54.40405@cse.msu.edu> Ah, pair-programming. We believe in pair-programming, but haven't figured out the best way to integrate it into this class. Here is what we do. Our weekly 'closed' labs require students to work in pairs on the in-lab problems. That has been very successful, although we do get resistance from a few students. We have weekly programming assignments ('projects' in the course nomenclature) that results in 11 over the semester. For a few years we have had at least one programming assignment which required pair-programming, but we have not had more than two such assignments. Those have been very successful. So, why not have all as pair-programming? I don't have a good defensible answer. Even worse is that we didn't have any pair-programming assignments this year because of the time expended on the transition to Python. My hope is that when we reach steady-state (maybe 'if' we reach steady-state) that we will be able to expand the number of pair-programming assignments. Pair-programming research states that the grading should be non-competitive, and we do have that structure, so we do have something to build on. Also, we do have in-class exercises that we encourage students to do in teams. Unfortunately, we do get students handing in code they didn't do -- a small minority, but a problem nonetheless. I wonder what would happen to such students in a purely pair-programming environment. Some research indicates that weak students would be pulled up sufficiently to not feel a need to cheat, but not all. I do need to get to PyCon and other Python venues, but travel funds are an issue. Here, the only travel funds are what you generate on research grants, and since none are related to Python I cannot use them. I need to be more creative. :-) (Also, it looks like a long-winded reply to an earlier question is being held per review of a moderator -- probably due to an attachment. Part of the learning curve, I guess.) -rich enbody at cse.msu.edu Anna Ravenscroft wrote: > On Thu, Mar 20, 2008 at 8:31 AM, Richard Enbody wrote: > >> Greetings. >> >> I'm a professor in Computer Science and Engineering at Michigan State >> University, and we started using Python last fall (2007) in our first >> programming course for majors (CS and CpE), i.e. a 'CS1' course. >> However, more than half the students are non-majors. The URL is >> http://www.cse.msu.edu/~cse231 >> >> > > The syllabus looks interesting. I notice your emphasis on not > allowing others to "look at" a student's solution. Given that most > coding these days involves teamwork, pair programming, or at least, > code reviews, are you considering any pair-programming or small team > projects in future iterations of the class? I believe some > universities have moved toward incorporating some team or partner > projects to help overcome the "loner" stereotype of programmers, and > draw more women and other populations to the major. > > >> I'm looking forward to interacting with you all (and I'm embarrassed >> that it took me so long to find this list). >> > > Welcome! Perhaps we'll meet you at PyCon next year? (It'll be in > Chicago again next spring.) > > From jonah at ccnmtl.columbia.edu Thu Mar 20 21:31:21 2008 From: jonah at ccnmtl.columbia.edu (Jonah Bossewitch) Date: Thu, 20 Mar 2008 15:31:21 -0500 Subject: [Edu-sig] PyCon Follow-up Message-ID: <47E2C999.6040506@ccnmtl.columbia.edu> Hi everyone, First, I want to let you know that I had a great time at our conference this year, despite all the blogo-grumblings to the contrary. Meeting up with many of the educators in the python community is one of the many reasons why. I mostly lurk on this list, but it occurs to me that I should be sharing more of my work here. Here is a model I have been working on for a while that captures some of the conversation I got into with educators this weekend: http://jonahboss.fastmail.fm/wikimania/wikimania_poster.pdf and it's elaborated on here: http://jonahboss.fastmail.fm/wildwildwiki/chap2_wiki_justice_final.doc and will soon be published in the forthcoming U. of Mich anthology on wikis in education: Wiki Writing:Collaborative Learning in the College Classroom I've also been writing alot about the OLPC project: Two academic essays: Plato and the Laptop: Prescribing Educational Technology for Society?s Ills Free Laptops: Creating, Producing and Sharing a Revolution A slideshow presentation: http://jonahboss.fastmail.fm/presentations/teach_think_play2007/html/ttp2007_olpc_bossewitch.html and some (hopefully) positive and constructive posts for OLPCnews: Have Faith in One Laptop Per Child Miracles Portable Culture Machines OLPC Personalization Stickers OLPC Leadership: Musicians or Instrument Makers Sharing and Not-Sharing Alike Finally, I wanted to add that I will likely be attending the New Media Consortium summer conference in Princeton - http://www.nmc.org/2008-summer-conference. Our group has found that community to be very supportive of the use the purposeful use of tech in ed. We also find their Horizon report helpful too - http://www.nmc.org/pdf/2008-Horizon-Report.pdf warm regards, /Jonah From lac at openend.se Thu Mar 20 22:50:41 2008 From: lac at openend.se (Laura Creighton) Date: Thu, 20 Mar 2008 22:50:41 +0100 Subject: [Edu-sig] introduction In-Reply-To: Message from Richard Enbody of "Thu, 20 Mar 2008 16:38:44 -0400." <47E2CB54.40405@cse.msu.edu> References: <47E28355.2030809@cse.msu.edu> <47E2CB54.40405@cse.msu.edu> Message-ID: <200803202150.m2KLofTL017288@theraft.openend.se> First, welcome. re 'how to do pair programming for a course'. There is a different between 'having a team of two people do a thing' and what is generally meant by pair programming. The idea with pair programming is that people work with *different* people, not the same other person, so that everybody gets a chance to pair with the best person, and the second best, and the worst and the second worst, with the aim to diffuse information through the group. It's not clear to me, from your note, that this is what you are trying to do. How many students do you have? There is disagreement about this, but there seems rough agreement that pair programming doesn't work very well in groups over a dozen (and some say over 6). So you will need to split your class into groups and then practice pairing within the groups. (At least for one assigment. You could randomise the students for the next assigment.) The thing that I have never been able to do, and thus never been able to do pairing as teaching as part of a regular course assignment (as opposed to learning camps) is insist that everybody has to come in and everybody work from XXX o'clock to YYY o'clock swapping pairs every 30 minutes, or however you plan on doing things. Of course, the way I would set things up is to have 3 or 4 stations where different parts of what would eventually be one program are being worked. After 30 minutes, one partner would leave for a different station. From there on in, there would always be one partner (the experienced one) who has been working at that station for 30 minutes, and one partner who is new to it. After 30 minutes, from then on in, the experienced one moves -- and becomes the inexperienced one at a new station -- while the formerly experienced one becomes the experienced one at the new station. Group meetings ahead of time are necessary, of course, to plan exactly how people are going to solve the problem. Otherwise you can thrash, as new people decide that they don't like the approach that is being taken, toss it, and try things their own way, only to have their work tossed aside. Also, its important to make sure that everybody is doing test driven development before embarking on a scheme like this. Otherwise, when people add work, they either break things and are unaware of this (the other people didn't leave enough tests) or they produce work which isn't appreciated by the next comers (I have no idea why this code is here, but it looks wrong, so let's rip it out.) But around here, at any rate, students cannot, even in groups as small as 6, commit to _everybody working for the same 6 hours_ so we can implement this. There are groups who have tried this, and had fun with the concept, but there are always a self-selected set that wanted to work this way, and could arrange their schedules to match. Other people just had too much in the way of scheduling conflicts. >Unfortunately, we do get students handing in code they didn't do -- a >small minority, but a problem nonetheless. I wonder what would happen >to such students in a purely pair-programming environment. Some >research indicates that weak students would be pulled up sufficiently to >not feel a need to cheat, but not all. You need to understand what 'cheating' would be in such a context, and also what 'code they didn't do' is. If you get pairing to work properly, _everybody_ will be handing in code which they didn't do. That's the whole point. If you are setting thing up so that people work together, learn together, but then go off and write their own versions of the thing in the end, then what you are doing isn't really pair programming. So you will have to figure out exactly what it is that you want to accomplish with however you want people to work together. But your effort at doing pair programming will be completely undermined if you try to also maintain the concept of 'this is my work'. Because that sort of code-ownership is precisely what pair programming aims to remove. If this 'everybody is handing in work, only some of which they have done' is a problem at your school -- i.e. your most important job is to produce a ranking of students roughly corresponding to the best to the worst, and actually teaching them things is secondary, then you will have problems implementing any sort of pair programming scheme. So, a question -- let us say you came up with a final exam which you thought would test the ability of the students to know the material. And let us say you gave them to your class and 85% of them got 85% or more on the test. Would that be a problem for you? Your students? Because this is the outcome that pair programming is aiming for -- so if you don't want to arrive there, then you may be better off _not_ doing pair programming, though letting people work in groups or teams. Is it possible to do without marks altogether and just do Pass/Fail? What sort of rewards and punishments you are required to implement will influence how well you can get pair programming to work for your goals, which I am interpreting primarily as raising the level of the weaker students, which may be a mistake on my part. When I was in school 'picking the best people to form an assignment team' (which you were then stuck with for the whole course) was the most important choice you could make in terms of getting the highest marks, and all the best students, who by second year, _knew_ they were the best students, had no interest in having anybody who wasn't one of the best students in their group. >I do need to get to PyCon and other Python venues, but travel funds are >an issue. Here, the only travel funds are what you generate on research >grants, and since none are related to Python I cannot use them. I need >to be more creative. :-) The PSF has a grant program, designed with people like you in mind. I don't know if we are going to have a pair programming clinic at Europython this year, but watch the Europython space and see what gets announced. http://www.europython.org/community Europython has a grant program as well, and there was some talk of having the PSF possibly fund some people's travel to Europython. >-rich >enbody at cse.msu.edu Good luck, and I can write a whole lot more about this, but I suspect this is already long enough, Laura Creighton From kirby.urner at gmail.com Fri Mar 21 00:44:55 2008 From: kirby.urner at gmail.com (kirby urner) Date: Thu, 20 Mar 2008 16:44:55 -0700 Subject: [Edu-sig] More followup after Chicago Pycon Message-ID: Hey, great seeing Jonah archiving here some! Way to go guy. Been studying your websites ever since Pycon, saw the footnote to Art of Memory by F.A. Yates, likewise highly important in the syllabus I go off. Excellent readings. Just wanted to share some more I learned thanks to Pycon, before I forget: So you know there're IronScheme (successor to IronLisp) and IronRuby yes? These plus this community's agile (on whatever VMs) has a bright future on open standard shared platforms, where you reap the benefits of synergy between languages i.e. Scheme really is much better for some things, as in Ruby in others. As a respectful alien, I see Ruby Planet as more like another Perl Republic, but then JavaScript is sporting list comprehensions and yield-based generator syntax these days (something else I learned at Pycon), so like the computer language DNA goes every which way doesn't it (like let's hear it for Icon). That's what open source is all about: sharing the wealth (I suppose what Commonwealth is supposed to mean, but I'm not from the UK so don't claim to be an authority). So I got one of those dreaded emails from a publisher wanting to discuss book prospects right at the conference, but sending it to my "at the office and not on the road address" so I wake up to read it eleven hours later by car (marathon road blitz -- why are those sections of I-net all *toll roads* in the eastern US? Our freeways out west are still free as in beer). I've missed some recent Pycons, plus OLPC was not a big topic at that Shuttleworth summit (about exactly a year back, remembering London Knowledge Lab was looking pretty empty because of bank holiday aka easter **). So this was a great opportunity to "catch the vibe" as they say, feel the excitement around the XOs (yes I have one, as my blog readers might know, write about it in connection with Unicode mostly (I have an interest in some exotic character sets)). That's not to say all is perfect in that picture, which seems chaordic in the extreme. ^^ Anyway, back in Portland, whew! Kirby PS: just saw about Arthur C. Clarke, great positive futurist dreamer, an inspiration, man of courage. ** http://www.bfi.org/bfi_community/pythonic_mathematics_talk_by_kirby_urner ^^ http://www.chaordic.org/ From andre.roberge at gmail.com Fri Mar 21 01:36:15 2008 From: andre.roberge at gmail.com (Andre Roberge) Date: Thu, 20 Mar 2008 21:36:15 -0300 Subject: [Edu-sig] Crunchy Suggestions wanted for Google Summer of Code Message-ID: <7528bcdd0803201736v92e4a3dxdcbe67fe90a872f2@mail.gmail.com> Hi everyone, The recent increase in activity in this group is nice - especially as it seems that Python is being used in an increasing number of educational institutions. I have enjoyed reading the (too few) reports about Pycon 2008. Unfortunately, I have been unable to attend. From the reports I read elsewhere, I gather that Johannes Woolard managed to interest a few more people in Crunchy; he was only one of two people (the other being Guido van Rossum) interviewed by Dr. Dobb's Journal (http://dobbscodetalk.com/index.php?option=com_myblog&show=Johannes-Woolard-On-Crunchy.html&Itemid=29). So, for those that have seen his talk, or talked to him, I was wondering if you have any suggestions to make for improvement to Crunchy during the upcoming Google Summer of Code. I have already been contacted by a few students already interested in doing a Crunchy-related project. Some project ideas can be found at: http://code.google.com/p/crunchy/wiki/SummerOfCodeIdeas Among them, is the following (based on an old suggestion by Jeff Elkner): === Create a collection of doctest-based problems for simple (and not so simple) Python exercises for list, strings, dicts, math functions, etc. The beginning of a collection can be found at http://code.google.com/p/doctests/source/browse; this is the list referred to at http://wiki.python.org/moin/ProblemSets/99_Prolog_Problems_Solutions for problems 1 to 6. === There are only a few days left before students start uploading their project ideas. So now is the time to make suggestions so that you can use Crunchy effectively next September ;-) Andr? From enbody at cse.msu.edu Fri Mar 21 02:49:39 2008 From: enbody at cse.msu.edu (Richard Enbody) Date: Thu, 20 Mar 2008 21:49:39 -0400 Subject: [Edu-sig] introduction In-Reply-To: <200803202150.m2KLofTL017288@theraft.openend.se> References: <47E28355.2030809@cse.msu.edu> <47E2CB54.40405@cse.msu.edu> <200803202150.m2KLofTL017288@theraft.openend.se> Message-ID: <47E31433.2070708@cse.msu.edu> We randomly assign within assigned labs -- the labs have 16-20 students. We assign within labs because there is a time, the assigned lab, when students can meet. That is, the excuse "we couldn't meet" is not valid. On a subsequent assignment we roll the dice again within the lab and ensure that the same two do not pair up again. If a partner is a 'no-show' we allow them to match with anyone else who is also paired with a 'no-show'. We have considered various matching schemes, but if I remember correctly, random is supposed to be the best way -- as opposed to trying to match students. We know about the 'driver' and 'thinker' roles and that the students should change roles. We talk about it with students, but do not try to enforce it. I like your model, but it would be difficult to implement here -- too many students have too much going on (unfortunately, for many that is a job to help them get through school). On your question about not having marks -- that isn't an option. On your question, 'what if 85% got 85%?' That would be great! Our grading scheme is not competitive -- if you get the points, you get the grade. In theory, everyone could get a 4.0 (A). My understanding is that you need such a scheme for pair-programming to succeed. However, with enough students we seem to get a spread out distribution. These questions have got me thinking! -rich enbody at cse.msu.edu Laura Creighton wrote: > First, welcome. > > re 'how to do pair programming for a course'. > > There is a different between 'having a team of two people do a thing' > and what is generally meant by pair programming. The idea with > pair programming is that people work with *different* people, not the > same other person, so that everybody gets a chance to pair with the > best person, and the second best, and the worst and the second worst, > with the aim to diffuse information through the group. It's not > clear to me, from your note, that this is what you are trying to do. > > How many students do you have? There is disagreement about this, but > there seems rough agreement that pair programming doesn't work very > well in groups over a dozen (and some say over 6). So you will need > to split your class into groups and then practice pairing within the > groups. (At least for one assigment. You could randomise the > students for the next assigment.) The thing that I have never been > able to do, and thus never been able to do pairing as teaching as part > of a regular course assignment (as opposed to learning camps) is > insist that everybody has to come in and everybody work from XXX > o'clock to YYY o'clock swapping pairs every 30 minutes, or however you > plan on doing things. Of course, the way I would set things up is to > have 3 or 4 stations where different parts of what would eventually be > one program are being worked. After 30 minutes, one partner would > leave for a different station. From there on in, there would always > be one partner (the experienced one) who has been working at that > station for 30 minutes, and one partner who is new to it. After 30 > minutes, from then on in, the experienced one moves -- and becomes the > inexperienced one at a new station -- while the formerly experienced > one becomes the experienced one at the new station. > > Group meetings ahead of time are necessary, of course, to plan exactly > how people are going to solve the problem. Otherwise you can thrash, > as new people decide that they don't like the approach that is being > taken, toss it, and try things their own way, only to have their work > tossed aside. > > Also, its important to make sure that everybody is doing test driven > development before embarking on a scheme like this. Otherwise, when > people add work, they either break things and are unaware of this > (the other people didn't leave enough tests) or they produce work > which isn't appreciated by the next comers (I have no idea why this > code is here, but it looks wrong, so let's rip it out.) > > But around here, at any rate, students cannot, even in groups as small > as 6, commit to _everybody working for the same 6 hours_ so we can > implement this. There are groups who have tried this, and had fun > with the concept, but there are always a self-selected set that wanted > to work this way, and could arrange their schedules to match. Other > people just had too much in the way of scheduling conflicts. > > >> Unfortunately, we do get students handing in code they didn't do -- a >> small minority, but a problem nonetheless. I wonder what would happen >> to such students in a purely pair-programming environment. Some >> research indicates that weak students would be pulled up sufficiently to >> not feel a need to cheat, but not all. >> > > You need to understand what 'cheating' would be in such a context, and > also what 'code they didn't do' is. If you get pairing to work > properly, _everybody_ will be handing in code which they didn't do. > That's the whole point. If you are setting thing up so that people > work together, learn together, but then go off and write their own > versions of the thing in the end, then what you are doing isn't really > pair programming. So you will have to figure out exactly what it is > that you want to accomplish with however you want people to work > together. But your effort at doing pair programming will be > completely undermined if you try to also maintain the concept of > 'this is my work'. Because that sort of code-ownership is precisely > what pair programming aims to remove. > > If this 'everybody is handing in work, only some of which they have > done' is a problem at your school -- i.e. your most important job is > to produce a ranking of students roughly corresponding to the best to > the worst, and actually teaching them things is secondary, then you > will have problems implementing any sort of pair programming scheme. > > So, a question -- let us say you came up with a final exam which you > thought would test the ability of the students to know the material. > And let us say you gave them to your class and 85% of them got 85% or > more on the test. Would that be a problem for you? Your students? > Because this is the outcome that pair programming is aiming for -- so > if you don't want to arrive there, then you may be better off _not_ > doing pair programming, though letting people work in groups or teams. > > Is it possible to do without marks altogether and just do Pass/Fail? > > What sort of rewards and punishments you are required to implement will > influence how well you can get pair programming to work for your goals, > which I am interpreting primarily as raising the level of the weaker > students, which may be a mistake on my part. When I was in school > 'picking the best people to form an assignment team' (which you > were then stuck with for the whole course) was the most important choice > you could make in terms of getting the highest marks, and all the best > students, who by second year, _knew_ they were the best students, had > no interest in having anybody who wasn't one of the best students in > their group. > > >> I do need to get to PyCon and other Python venues, but travel funds are >> an issue. Here, the only travel funds are what you generate on research >> grants, and since none are related to Python I cannot use them. I need >> to be more creative. :-) >> > > The PSF has a grant program, designed with people like you in mind. > > I don't know if we are going to have a pair programming clinic at > Europython this year, but watch the Europython space and see what > gets announced. http://www.europython.org/community Europython has > a grant program as well, and there was some talk of having the PSF > possibly fund some people's travel to Europython. > > > > >> -rich >> enbody at cse.msu.edu >> > > Good luck, and I can write a whole lot more about this, but > I suspect this is already long enough, > > Laura Creighton > From macquigg at ece.arizona.edu Fri Mar 21 03:09:29 2008 From: macquigg at ece.arizona.edu (David MacQuigg) Date: Thu, 20 Mar 2008 19:09:29 -0700 Subject: [Edu-sig] Introducing Python to Engineering Students In-Reply-To: <47E1B2D2.4020102@gmail.com> References: <5.2.1.1.0.20080319113343.02b03ec0@mail.ece.arizona.edu> <5.2.1.1.0.20080312161322.02c1daf0@mail.ece.arizona.edu> <5.2.1.1.0.20080311170340.03959b10@mail.ece.arizona.edu> <5.2.1.1.0.20080311170340.03959b10@mail.ece.arizona.edu> <5.2.1.1.0.20080312161322.02c1daf0@mail.ece.arizona.edu> <5.2.1.1.0.20080319113343.02b03ec0@mail.ece.arizona.edu> Message-ID: <5.2.1.1.0.20080320185503.02b2f050@mail.ece.arizona.edu> At 01:41 AM 3/20/2008 +0100, Stef Mientki wrote: >I started about a year ago with the Enthought edition >http://code.enthought.com/enthon/ This leads to a series of deprecated links, some several months old, and no clear guidance as to what a student should install. This website is a mess!! >under windows-XP, 4 machines some SP1, some SP2, >used embedded in Delphi, as a direct replacement for embedded Matlab, >everything worked like a charm. >In fact everything worked so well, >that about 3 months ago, >I decided to make a pure Python (open source) LabView equivalent with it >(should be released in a couple of weeks). >In the meanwhile I also tried to update Scipy, >but Enthought switched to the eggs-philosophy, >which seems to be a big disaster to me ( so I rolled everything back to >the orginal Entought suite). I've been hearing good things about eggs, so I'm a little surprised at this. Having a manager for Python packages seems like a good idea, but I would rather use the standard egg installer from http://peak.telecommunity.com/DevCenter/EasyInstall, not an "enstaller" hacked for installing one vendor's products. That could lead to conflicts later, as I add eggs from different sources. >I think if you send this message to the Scipy list, >you get an answer of Robert Kern himself within half an hour (if he is >awake ;-) What I'm looking for is not help with the current mess, but confidence that students won't have to go through the same thing. I've now run out of time, so I'll have to try again in a few months. -- Dave From lac at openend.se Fri Mar 21 07:54:48 2008 From: lac at openend.se (Laura Creighton) Date: Fri, 21 Mar 2008 07:54:48 +0100 Subject: [Edu-sig] introduction In-Reply-To: Message from Richard Enbody of "Thu, 20 Mar 2008 21:49:39 -0400." <47E31433.2070708@cse.msu.edu> References: <47E28355.2030809@cse.msu.edu> <47E2CB54.40405@cse.msu.edu> <200803202150.m2KLofTL017288@theraft.openend.se> <47E31433.2070708@cse.msu.edu> Message-ID: <200803210654.m2L6sm8j029128@theraft.openend.se> In a message of Thu, 20 Mar 2008 21:49:39 -0400, Richard Enbody writes: >We randomly assign within assigned labs -- the labs have 16-20 >students. We assign within labs because there is a time, the assigned >lab, when students can meet. That is, the excuse "we couldn't meet" is >not valid. On a subsequent assignment we roll the dice again within the >lab and ensure that the same two do not pair up again. If a partner is >a 'no-show' we allow them to match with anyone else who is also paired >with a 'no-show'. We have considered various matching schemes, but if >I remember correctly, random is supposed to be the best way -- as >opposed to trying to match students. 16-20 is considered oversize if you want to get everybody pairing with everybody, so I would partition my class into 3 groups of 6 or 8 (or maybe 2 groups of 8 for the 16 case), and then build a rotation schemee for each group, not getting the groups to interpenetrate. Random isn't exactly what you are looking for. When people say that it is better to partner randomly, what they mean is that you need a mechanism to keep people who like working together from doing just that. But simple randomness isn't going to ensure that everybody gets to pair with everybody unless there are a really large number of sessions for 'changing pairs'. I've got some more questions: How long do you have to work with these people? How long is a lab, and how many rotations do you try to fit into a lab? and How long is a course, and how many labs in a course? How much work do you expect people to do on the programs outside of lab time? Are the labs self-contained, or do they build on each other's work? >We know about the 'driver' and 'thinker' roles and that the students >should change roles. We talk about it with students, but do not try to >enforce it. I've always had problems with that concept -- or rather, with the idea that the 'driver' is the one doing the typing, and the 'thinker' is the one doing the watching. Some students I know think a lot better when they are typing than when they aren't. Some students who aren't typing pretty much dictate what the typer is going to type. So I don't know if I am just doing something wrong, or if the model is unrealistic. >I like your model, but it would be difficult to implement here -- too >many students have too much going on (unfortunately, for many that is a >job to help them get through school). I have this problem, too, which is why we mostly can only experiment with things like that in Summer courses, and camps, where you are trying to pack what would normally be taught in 4 months or 8 months into 2. And still there are some people who cannot make the time. >On your question about not having marks -- that isn't an option. On >your question, 'what if 85% got 85%?' That would be great! Our grading >scheme is not competitive -- if you get the points, you get the grade. >In theory, everyone could get a 4.0 (A). My understanding is that you >need such a scheme for pair-programming to succeed. However, with >enough students we seem to get a spread out distribution. This is an indication that your weaker students aren't catching up enough. The question is, why? If you are trying to get rotation through groups of size 16 or 20, that is probably one contributing factor. If the assigment runs out before the students who began working on it can get back to it for a second pass, while having done other things in the meantime, then that is another factor. There are others I have seen, and some I have only heard about, such as trying to do pair programming and not doing test driven design. Are you doing that, as well? >These questions have got me thinking! Great. :-) > >-rich >enbody at cse.msu.edu Laura From kirby.urner at gmail.com Fri Mar 21 17:30:51 2008 From: kirby.urner at gmail.com (kirby urner) Date: Fri, 21 Mar 2008 09:30:51 -0700 Subject: [Edu-sig] introduction In-Reply-To: <200803210654.m2L6sm8j029128@theraft.openend.se> References: <47E28355.2030809@cse.msu.edu> <47E2CB54.40405@cse.msu.edu> <200803202150.m2KLofTL017288@theraft.openend.se> <47E31433.2070708@cse.msu.edu> <200803210654.m2L6sm8j029128@theraft.openend.se> Message-ID: On Thu, Mar 20, 2008 at 11:54 PM, Laura Creighton wrote: > >We know about the 'driver' and 'thinker' roles and that the students > >should change roles. We talk about it with students, but do not try to > >enforce it. > > I've always had problems with that concept -- or rather, with the idea > that the 'driver' is the one doing the typing, and the 'thinker' is > the one doing the watching. Some students I know think a lot better > when they are typing than when they aren't. Some students who aren't > typing pretty much dictate what the typer is going to type. So I don't > know if I am just doing something wrong, or if the model is unrealistic. > Hi Laura -- I think your point about randomizing, and your other point about how the roles aren't always so cut and dried, are connected. The real point of pair programming is the old adage "two heads are better than one" (and yet "too many cooks spoil the broth" i.e. just because two usually works doesn't prevent five from being routinely disastrous). In Vilnius, I was paired with this talent from Google Warsaw who barely knew Python, but was through the roof smart and knew Java already, so was taking this opportunity to suck up Python like a sponge. Since I'm happy teaching Python, our productivity was very high, not saying other pairs weren't higher (you generally don't need to "grade pairs" in XP, a corollary to the frequent repairing operation, garbage collecting of bad karma that way). In other jobs, I'm paired with this guy who clearly knows Python way better than me, along with C, Eiffel, and everything else, so I'm just at the feet of some guru, maybe having panic attacks about the likely fate of my ego on this job. And that can work. I don't mind worshiping guys 'n dolls ** as long as we get the job done. It really helps knowing the randomizer will come along pretty soon and split us i.e. I'm way more willing to be productive in short term partnerships than "your pair programmer for life" kind of arrangements. Yes, it's only a matter of time before the psychologists fill the shelves with their analyses of XP techniques, why they work, or are dangerous, making the whole field way more introspective -- often not to the liking of engineers, who went to computing in spare environments to escape a steady drum beat of mumbo jumbo all the time. More fun to make spaceships fly around in Blender or whatever. But let's be clear about something else while we're at it. I live in Portland, and Europython in Vilnius isn't any "just anywhere" either. So I'm professionally involved with some cutting edge XP proponents, and that's not equally true everywhere in the country. A lot of colleges and universities have no choice but to mirror corporate middle America or wherever and there's just no way a true "anybody with anybody" XP shop is going to emerge so spontaneously in the classroom, let alone in the work place. It's just not a part of the culture, whereas maybe at Microsoft (where our guest speaker was from) it is. Microsoft is enormously prosperous for a reason, not just because Windows sucks A lot of the Pycon talks were about "why Python sucks" in various ways -- a whole genre, an inhouse counterculture. Like one guy hates __import__, how it works now. I'm not saying I followed in detail, but that didn't keep me from liking the vibrancy -- from __future__ looks bright. And I *really* liked the All About Unicode talk. Very precise and clear, helped me a lot. How ASCII became Unicode is what we feed to 2nd and 3rd graders in our neck of the woods, so basic to everything, like the birds and the bees. Kirby From kirby.urner at gmail.com Fri Mar 21 17:42:53 2008 From: kirby.urner at gmail.com (kirby urner) Date: Fri, 21 Mar 2008 09:42:53 -0700 Subject: [Edu-sig] introduction In-Reply-To: References: <47E28355.2030809@cse.msu.edu> <47E2CB54.40405@cse.msu.edu> <200803202150.m2KLofTL017288@theraft.openend.se> <47E31433.2070708@cse.msu.edu> <200803210654.m2L6sm8j029128@theraft.openend.se> Message-ID: > I don't mind worshiping guys 'n dolls ** as long as we get the job > done. It really helps knowing the randomizer will come along pretty > soon and split us i.e. I'm way more willing to be productive in > short term partnerships than "your pair programmer for life" > kind of arrangements. > ** allusion to a musical. I grew up in a family where the dad "doesn't like musicals" (ICEscapades either) and I too am not in the habit of delving in that genre, though I don't say I hate them, on the contrary loved the last couple (one starring a Wanderer's daughter at Jesuit in Beaverton, the other Wicked in Hollywood over Xmas), but in the name of pair programming and mixing it up more, why not? Plus our household *does* officially approve of the musical episode in Buffy, given we're such Joss Whedon and Peggy Parsons fans in these parts. More pop culture allusions sorry, and yeah, I'm a huge Britney Spears fan (my friends will tell you) who in turn helps me more appreciate Madonna. Like that Hate Me guy too, and that Over the Hedge guy starting to like. More in my blogs for the morbidly curious :-D. Kirby From kirby.urner at gmail.com Fri Mar 21 22:32:14 2008 From: kirby.urner at gmail.com (kirby urner) Date: Fri, 21 Mar 2008 14:32:14 -0700 Subject: [Edu-sig] introduction In-Reply-To: References: <47E28355.2030809@cse.msu.edu> <47E2CB54.40405@cse.msu.edu> <200803202150.m2KLofTL017288@theraft.openend.se> <47E31433.2070708@cse.msu.edu> <200803210654.m2L6sm8j029128@theraft.openend.se> Message-ID: > In Vilnius, I was paired with this talent from Google Warsaw who > barely knew Python, but was through the roof smart and knew Java > already, so was taking this opportunity to suck up Python like a > sponge. Since I'm happy teaching Python, our productivity was > very high, not saying other pairs weren't higher (you generally > don't need to "grade pairs" in XP, a corollary to the frequent > repairing operation, garbage collecting of bad karma that way). Just to give more background, this technique of switching quite often, like every 90 minutes, is called "promiscuous pairing" in XP and is considered advanced, not necessarily a good starting place, per this blog entry: http://blog.excastle.com/2006/07/25/promiscuous-pairing-and-beginners-mind/ The presentation I was referring to in Vilnius was by Arlo Belshee as you'll see on this schedule (Wednesday): http://indico.cern.ch/conferenceTimeTable.py?confId=13919&detailLevel=contribution&viewMode=room He's with BlueTech, not Microsoft: http://www.linkedin.com/pub/0/13b/0ab I'm not really sure how much XP is used in Redmond, not being an insider there (though with friends on the inside). Let's just say I suspect quite a lot, as savvy software engineers tend to adopt best practices out of necessity to keep up. Anyway, we're using it around Portland and if I get that adult student gig I'm angling for (building a tag team) you can be sure we'll be writing lots of unit tests (which sometimes double as "demo defs" for a Python module, i.e. they advertise what it does). Kirby From aharrin at luc.edu Sat Mar 22 06:38:49 2008 From: aharrin at luc.edu (Andrew Harrington) Date: Sat, 22 Mar 2008 00:38:49 -0500 Subject: [Edu-sig] Crunchy Suggestions wanted for Google Summer of Code In-Reply-To: <7528bcdd0803201736v92e4a3dxdcbe67fe90a872f2@mail.gmail.com> References: <7528bcdd0803201736v92e4a3dxdcbe67fe90a872f2@mail.gmail.com> Message-ID: Dear Andre, Sorry to miss you at Pycon. It was nice to get to know Johannes. I am excited by Jeff's plan to crunchify his book. As we get a larger body of tutorials and problems, we are getting to the time when it would be good to be able to choose the next page to go to based on whether a student succeeded or failed at an exercise tested by doctest. Andy On Thu, Mar 20, 2008 at 7:36 PM, Andre Roberge wrote: > Hi everyone, > > The recent increase in activity in this group is nice - especially as > it seems that Python is being used in an increasing number of > educational institutions. > > I have enjoyed reading the (too few) reports about Pycon 2008. > Unfortunately, I have been unable to attend. From the reports I read > elsewhere, I gather that Johannes Woolard managed to interest a few > more people in Crunchy; he was only one of two people (the other being > Guido van Rossum) interviewed by Dr. Dobb's Journal > ( > http://dobbscodetalk.com/index.php?option=com_myblog&show=Johannes-Woolard-On-Crunchy.html&Itemid=29 > ). > So, for those that have seen his talk, or talked to him, I was > wondering if you have any suggestions to make for improvement to > Crunchy during the upcoming Google Summer of Code. > > I have already been contacted by a few students already interested in > doing a Crunchy-related project. Some project ideas can be found at: > http://code.google.com/p/crunchy/wiki/SummerOfCodeIdeas > > Among them, is the following (based on an old suggestion by Jeff Elkner): > === > Create a collection of doctest-based problems for simple (and not so > simple) Python exercises for list, strings, dicts, math functions, > etc. The beginning of a collection can be found at > http://code.google.com/p/doctests/source/browse; this is the list > referred to at > http://wiki.python.org/moin/ProblemSets/99_Prolog_Problems_Solutions > for problems 1 to 6. > === > > There are only a few days left before students start uploading their > project ideas. So now is the time to make suggestions so that you can > use Crunchy effectively next September ;-) > > Andr? > _______________________________________________ > Edu-sig mailing list > Edu-sig at python.org > http://mail.python.org/mailman/listinfo/edu-sig > -- Andrew N. Harrington Director of Academic Programs Computer Science Department Loyola University Chicago 512B Lewis Towers (office) Snail mail to Lewis Towers 416 820 North Michigan Avenue Chicago, Illinois 60611 http://www.cs.luc.edu/~anh Phone: 312-915-7982 Fax: 312-915-7998 gdp at cs.luc.edu for graduate administration upd at cs.luc.edu for undergrad administration aharrin at luc.edu as professor -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/edu-sig/attachments/20080322/52e5883e/attachment.htm From kirby.urner at gmail.com Tue Mar 25 07:28:25 2008 From: kirby.urner at gmail.com (kirby urner) Date: Mon, 24 Mar 2008 23:28:25 -0700 Subject: [Edu-sig] Session 53 (Pythonic Math Class) on Google Video Message-ID: http://video.google.com/videoplay?docid=4007622124508476663&hl=en Description: Kirby Urner addresses conferees in Crowne Plaza Hotel, March 14, 2008. This is the audio track from that event, slightly edited, supplemented with stills and short screen scenarios, added later in Portland, but in many ways matching what got screened at the talk. Kirby From kirby.urner at gmail.com Sun Mar 30 19:38:34 2008 From: kirby.urner at gmail.com (kirby urner) Date: Sun, 30 Mar 2008 10:38:34 -0700 Subject: [Edu-sig] More on decorators Message-ID: Here's a little module about the power of decorators. We show decorators used in two capacities: 1. to invoke the built-in classmethod wrapper, giving us a way to invoke methods on a class with no "self objects" 2. to wrap a user-defined cost with a user-defined sales_tax with a flexible percentage (defaults to 10%). ==== taxes.py ==== from random import randint def sales_tax(sale, percent = 0.1): def vat(x): before = sale(x) after = (1 + percent) * before print("Before: %s; After: %s" % (before, after)) return after return vat class Register: shipping = 1.70 # fixed cost @sales_tax def __cost(price): return price + Register.shipping @classmethod def transact(klass, price): return klass.__cost(price) def test(): print(Register) for i in range(10): Register.transact(randint(1,100)) However, I'd consider the above too complicated, so refactor below: ==== taxes.py ==== from random import randint def sales_tax(sale, percent = 0.1): def vat(x): before = sale(x) after = (1 + percent) * before print("Before: %s; After: %s" % (before, after)) return after return vat # fixed cost shipping = 1.70 @sales_tax def cost(price): return price + shipping class Register: @classmethod def transact(klass, price): return cost(price) def test(): print(Register) for i in range(10): Register.transact(randint(1,100)) What's cooler is we're also demonstrating how decorator syntax makes as much sense outside a class definition, plus we're playing a different scope game, with Register reaching outside its class for a more global cost function (it really didn't have been inside the class def in the first example), which in turn relies on the global shipping variable. In the lesson plan I'm dreaming up, it'd be useful to show both examples, as we're showing off the freedoms you have when it comes to mixing functions and classes top level, in addition to decorator syntax. Regarding decorators, I think I good way to teach them *is* to recapitulate their motivation. Having to define the function first, before wrapping it in clunky f = g(f) syntax at the end, was making for less readable code. @ is Python's function composer, with the second argument a function def and source of the name, the first argument functional wrapper for the second i.e. @f def g(args) ... is the same as g = f(g(args)) Earlier in the buildup to such as the above, we'll look at simpler more algebraic examples of function composition . >>> def f(h): def k(x): return h(x) + 2 return k >>> @ f def g(x): return x**2 >>> print(g(10)) 102 >>> print(g(12)) 146 Then go for fancier user-defined examples, including with argument passing. >>> def f(a): if a == 1: def n(targ): def z(x): return targ(x) + 2 return z return n if a == 2: def n(targ): def z(x): return targ(x) + 3 return z return n >>> f(1)(g) >>> f(1) >>> @f(1) def g(x): return x * x >>> g(10) 102 >>> @f(2) def g(x): return x * x >>> g(10) 103 Kirby From mpaul213 at gmail.com Sun Mar 30 19:50:28 2008 From: mpaul213 at gmail.com (michel paul) Date: Sun, 30 Mar 2008 10:50:28 -0700 Subject: [Edu-sig] manifesto Message-ID: <40ea4eb00803301050s66221b33sc6e77241dde8564b@mail.gmail.com> My dept chair finally agreed to let me have an hour to present Python to the math dept during our staff development day last Friday. I knew that an hour wouldn't be enough, so I wrote a manifesto : ) which is attached. I instructed my colleagues to install Python and download the manifesto on their laptops and bring them to my room for the session. I didn't want to do it in a lab, as I didn't want them to think of Python as something remote. I wanted them to see how easily accessible all this is. When you run the manifesto, the first thing that appears is a question asking, "How many digits of pi would you like to generate today?" We decided on 1000, and as the digits were printing I exclaimed, "You've NEVER seen this happen before, have you?" That was fun. Then I had them do some bare bones Shell interactions - 2**10000, etc. I didn't dwell on Python exclusively - I showed various quotes from the 2020 report a few years ago, the recently released final report from the National Math Advisory Panel stating that research DOES bear out the usefulness of programming in math for concept formation, and an opinion piece from the American Mathematical Society on the importance of open source vs. proprietary software in mathematical discourse. I think that helped shift the discussion to another level - it was clear that I wasn't simply talking about just another kind of calculator. It seemed to go very well - during the presentation I felt that my message was getting across, and they even applauded at the end! So, slowly, slowly, slowly, resistance is being overcome. - Michel Paul P.S. The reference to the colored text and "Go Normans!" was kind of an inside joke. Black and orange are our school colors, and at the end of all announcements the principle always says, "Gooooooo Normans!" -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/edu-sig/attachments/20080330/110f08c1/attachment-0001.htm -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: manifesto.py Url: http://mail.python.org/pipermail/edu-sig/attachments/20080330/110f08c1/attachment-0001.txt From kirby.urner at gmail.com Mon Mar 31 05:08:33 2008 From: kirby.urner at gmail.com (kirby urner) Date: Sun, 30 Mar 2008 20:08:33 -0700 Subject: [Edu-sig] manifesto In-Reply-To: <40ea4eb00803301050s66221b33sc6e77241dde8564b@mail.gmail.com> References: <40ea4eb00803301050s66221b33sc6e77241dde8564b@mail.gmail.com> Message-ID: 2008/3/30 michel paul : > My dept chair finally agreed to let me have an hour to present Python to the > math dept during our staff development day last Friday. I knew that an hour > wouldn't be enough, so I wrote a manifesto : ) which is attached. > Good work, seems to me. Bravo! Your invitation to preload Python seems strategic. I'll risk adding VPython when it's just me projecting, but that's a lot to asks of people skeptical of the whole idea of computers, still stuck in that "calculators rule!" mindset. It's easy to turn VPython into an XY plotter (even if Z axis is always implicit), for showing parabolas, other polynomials, any types with a sensible self.draw() method. Anyway, it helps to know I'm not the only gnu math teacher out there. I wish you success in recruiting more talent into our ranks. :-D Kirby From mdipierro at cs.depaul.edu Mon Mar 31 08:41:03 2008 From: mdipierro at cs.depaul.edu (Massimo Di Pierro) Date: Mon, 31 Mar 2008 01:41:03 -0500 Subject: [Edu-sig] teaching with python experience Message-ID: Hello everybody, I would like to share some of my experience in teaching Python at DePaul University in Computer Science. The main problem we have been facing with C++ and Java courses is that it takes years of practice before students are able to develop something interesting. We tried different approaches: 1) We created an optional introductory sequence in Python (in alternative to Java or C++, but they still have to learn Java and C++ in more advanced courses). Students who take the class tend to be generally more knowledgeable of CS concepts than students who choose the Java and C++ intro courses (who chose them because they have heard of the names). 2) We use Python more and more in courses that are not language specific. For example I teach graduate courses on Monte Carlo Simulations for Financial Applications, a course on Scientific Computing and a course on Parallel Programming. In all these courses I use python instead of pseudo code and the students get it right away even if they have not been trained in the language. In some cases they have to translate python in C++ but Python helps them separate the complexity of the algorithms from the complexity of C++ progamming. 3) We created a new course on web frameworks in Python. The course is not on the usage of one particular framework, although we had to choose one, but on the programming patterns used to develop frameworks. This course was targeted to both undergraduates and graduates students in order to fill gaps in their knowledge. The basic idea was to follow the path of an HTTP request from the moment its is generated by a browser until it reaches the server, is processed and the response is sent back. We discussed good practice, security, different types of persistence (database, cookies, sessions, filesystem, ram) and the Model View Controller design. Most of the students had no previous python experience and no server-side programming experience. They all new HTML but minimal CSS and zero knowledge of network protocols such as HTTP. After evaluating a number of web frameworks and having tried to teach a previous course using Django I found that most of the existing frameworks have a too steep learning curve. A typical problem for example is the need for shell commands (Ruby on Rails, Django, Pylons, TurboGears, they all require use of a shell) but most students have only bee exposed to windows and they the concept of shell very alien to them. In order to solve this problem I wrote http://mdp.cti.depaul.edu (TRY THE LIVE DEMO ONLINE) (GPL license) specifically for these students. This experiment had more success than expected and all students in the class have been able to create decent projects using the framework and the best students got more involved the core development, joined the mailing list and were glad to give a real contribution to their first open source project. For some reason, since then, web2py has picked up some steam more in the business environment than in the teaching environment. Although my class was not targeted to freshmen, it could have been (with some changes). My experience with 3) is that students appreciate programming better when they develop something that they can use, that they can show their friends who are not computer scientists, and they get it. One way to do it is by programming inside a web framework (whether it is web2py or Django or Pylons does not really matter). Some things are different and some things are the same when compared with teaching "normal" programming: a) One visits a URL and a function is called, the output of the function is sent back to the browser. You still has to write the function, but the concept is more intuitive than calling a function from main(). They get it right away because it is related to their everyday experience. They also understand parameters passing because they are familiar with filling forms online. In the case of a full stack framework all of the work is actually done by the framework itself, the students only have to write the function the "returns" the response as a string. b) Conditionals are not much different than in "normal" programming. c) Loops are somewhat less important in the initial phase because there is a lot one can do without looping. This is good because it is with loops that students have the most trouble. d) Most web frameworks abstract the access to the database, therefore adding real database persistence is not much more difficult than using a member variable of a Java class. This enables students to created rich functionalities with a small set of API. e) cookie, sessions and cache add a small level of complexity but a good web framework should be able to take care of these issues transparently. web2py does. Django, Pylons and TurboGears doo to although they require some configuration. f) They do not need to know HTML because they can use an HTML WYSIWYG editor. Moreover in doing web programming at a more advanced level, two crucial CS tasks show up naturally: regular expressions (for validation of user input) and parsing (for reading HTML/XML/XML-RPC/ RSS and for all kind of tasks like parsing code embedded in a web page, for performing syntax highlighting, etc.). These are concepts that every CS major should know but we often teach them in ways that do not relate to the everyday experience of the students. ***** Anyway, the bottom line is that instead of start teaching programming using programs that interact with a shell or with a GUI, today it is becoming easier and easier to write programs that interact with the web. There is a small overhead but a lot more power and fun for the students. Personally I am going to follow this approach in other courses that I am teaching that do not require python and do not require web development. If you want to try it too and have questions let me know. I will be happy to share my experience and material. Massimo From kirby.urner at gmail.com Mon Mar 31 13:45:04 2008 From: kirby.urner at gmail.com (kirby urner) Date: Mon, 31 Mar 2008 04:45:04 -0700 Subject: [Edu-sig] teaching with python experience In-Reply-To: References: Message-ID: On Sun, Mar 30, 2008 at 11:41 PM, Massimo Di Pierro wrote: > The basic idea was to follow the path of an HTTP request from > the moment its is generated by a browser until it reaches the server, is > processed and the response is sent back. You're probably aware of this movie: http://www.warriorsofthe.net/ I like projecting short cartoons. The above is a little long for classroom use, but my students have enjoyed it (usually younger than yours, but I've had adult classes too, wherein the above was appreciated). Kirby > > Massimo > > _______________________________________________ > Edu-sig mailing list > Edu-sig at python.org > http://mail.python.org/mailman/listinfo/edu-sig > From macquigg at ece.arizona.edu Mon Mar 31 21:45:26 2008 From: macquigg at ece.arizona.edu (David MacQuigg) Date: Mon, 31 Mar 2008 12:45:26 -0700 Subject: [Edu-sig] manifesto Message-ID: <5.2.1.1.0.20080331124505.03c93a38@pop.mail.yahoo.com> At 10:50 AM 3/30/2008 -0700, you wrote: >My dept chair finally agreed to let me have an hour to present Python to the math dept during our staff development day last Friday. I knew that an hour wouldn't be enough, so I wrote a manifesto : ) which is attached. Excellent!! I'll pass this on to the faculty at our community college. When I suggested Python a few months ago, the reaction was - Oh God, not another language! We've tried C, Java, QBASIC. Our students just can't handle it. So they switched to ALICE!! I like your comments about the status quo: >Many people think of technology as something that programmers create for us, that programmers should just do their job while we kick back and play with, or 'use', what they have created. We, the users, shouldn't have to worry about programming itself, as, after all, that's what 'programmers' get paid to do. > >This is what is happening in the sciences these days. Scientists cannot rely on already existing software packages to be able to express the ideas they are working on. What they need is an easy to use language that is also robust. For many, Python fits the bill. I would add "engineering" and maybe some areas of business management as well. As a circuit design engineer, I can say this description fits perfectly what I have seen. Modern IC design is so complex, all we can do is rely on professional programmers to provide us with the tools to simulate our designs. Big companies, like where I worked, have entire departments with as many as 30 programmers working full time for just the engineers in that one company. Smaller companies have to rely on what comes with the original software, which is often poorly written by programmers who don't understand what circuit designers need, or just don't have time to provide all the options needed for every design problem. The Monte Carlo analysis, for example, was just awful - menus and forms with poorly documented options, and results you could never trust. In the time it took to "experiment" with the tools, and try to figure out what they really did with my circuit, I could write my own Monte Carlo analysis, and that is what I wanted to do. I even sketched out a bit of pseudo-code (was not aware of Python at the time). I felt handicapped by the tools, and very frustrated. Engineers can understand algorithms, and they can easily read and modify a program written in Python. They just don't have time to keep up to speed in Java or C++, or to learn the proprietary languages that most of these tools are written in. What they really need is a framework in which the circuit-analysis "engines" may be written in C, but the controlling scripts are written in Python. Instead of trying to provide every possible option for a Monte Carlo analysis, just give us a script that runs the engines to do a basic analysis. Thank you, we'll take it from there. Keep up the good work!! -- Dave