From pdx4d@teleport.com Tue May 1 06:05:00 2001 From: pdx4d@teleport.com (Kirby Urner) Date: Mon, 30 Apr 2001 22:05:00 -0700 Subject: [Edu-sig] Algebra + Python In-Reply-To: <3AED9951.1511FA55@fa.disney.com> Message-ID: <000401c0d1fc$46b4ed40$0802a8c0@KirbyUrner> >Kirby wrote: >> There may be a better way to write the factory function than >> I've shown below. I'd like to see other solutions: >> >> >>> def makepoly(A,B,C): >> """ >> Build a polynomial function from coefficients >> """ >> return eval("lambda x: %s*x**2 + %s*x + %s" % (A,B,C)) > >How about this? > > class poly: > def __init__(self, A, B, C): > self.A, self.B, self.C = A, B, C > def __call__(self, x): > return self.A * x**2 + self.B * x + self.C > > >>> f = poly(2,3,4) > >>> f(10) > 234 I like it! Kirby From pdx4d@teleport.com Tue May 1 07:44:15 2001 From: pdx4d@teleport.com (Kirby Urner) Date: Mon, 30 Apr 2001 23:44:15 -0700 Subject: [Edu-sig] Algebra + Python In-Reply-To: <000401c0d1fc$46b4ed40$0802a8c0@KirbyUrner> Message-ID: <000701c0d20a$258430a0$0802a8c0@KirbyUrner> I elaborated on Brent's excellent suggestion for a post to k12.ed.math (which you can check via http://www.mathforum.com/epigone/k12.ed.math/ ). The Poly objects are in play: >>> f = Poly([2,3,4]) >>> f Polynomial: 2*x**2 + 3*x + 4 >>> f(10) 234 >>> f.degree 2 >>> f.deriv() Polynomial: 4*x + 3 >>> df = f.deriv() >>> df(10) 43 >>> g = Poly([-1,0,0,2]) >>> g Polynomial: -1*x**3 + 2 >>> g(-1) 3 >>> dg = g.deriv() >>> dg Polynomial: -3*x**2 >>> dg(-1) -3 Kirby From schoen@loyalty.org Tue May 1 07:54:01 2001 From: schoen@loyalty.org (Seth David Schoen) Date: Mon, 30 Apr 2001 23:54:01 -0700 Subject: [Edu-sig] Algebra + Python In-Reply-To: <000701c0d20a$258430a0$0802a8c0@KirbyUrner>; from pdx4d@teleport.com on Mon, Apr 30, 2001 at 11:44:15PM -0700 References: <000401c0d1fc$46b4ed40$0802a8c0@KirbyUrner> <000701c0d20a$258430a0$0802a8c0@KirbyUrner> Message-ID: <20010430235401.N5636@zork.net> Kirby Urner writes: > The Poly objects are in play: > > >>> f = Poly([2,3,4]) > >>> f > Polynomial: 2*x**2 + 3*x + 4 > >>> f(10) > 234 > >>> f.degree > 2 > >>> f.deriv() > Polynomial: 4*x + 3 > >>> df = f.deriv() > >>> df(10) > 43 > >>> g = Poly([-1,0,0,2]) > >>> g > Polynomial: -1*x**3 + 2 > >>> g(-1) > 3 > >>> dg = g.deriv() > >>> dg > Polynomial: -3*x**2 > >>> dg(-1) > -3 Could this be extended to a symbolic math implementation? At least, could you implement compose, add, subtract, multiply, and divide methods so that f.compose(g) f.add(g) would work? -- Seth David Schoen | And do not say, I will study when I Temp. http://www.loyalty.org/~schoen/ | have leisure; for perhaps you will down: http://www.loyalty.org/ (CAF) | not have leisure. -- Pirke Avot 2:5 From pdx4d@teleport.com Tue May 1 10:11:30 2001 From: pdx4d@teleport.com (Kirby Urner) Date: Tue, 1 May 2001 02:11:30 -0700 Subject: [Edu-sig] Algebra + Python In-Reply-To: <20010430235401.N5636@zork.net> Message-ID: <000801c0d21e$b6a21020$0802a8c0@KirbyUrner> Could this be extended to a symbolic math implementation? At least, could you implement compose, add, subtract, multiply, and divide methods so that f.compose(g) f.add(g) would work? -- Seth David Schoen | And do not say, I will study when I Temp. http://www.loyalty.org/~schoen/ | have leisure; for perhaps you will down: http://www.loyalty.org/ (CAF) | not have leisure. -- Pirke Avot 2:5 ============ Sure. Compose was already implied in Brent's class, since f(10) returns a number, and therefore so does g(f(10)) and g(f(10)). Using operator overriding, we can actually use + - and * for addition, subtraction and multiplication (I haven't done divide): Definition and Representation: >>> f = Poly([1,2,3]) >>> f x**2 + 2*x + 3 >>> g = Poly([2,3,4,5]) >>> g 2*x**3 + 3*x**2 + 4*x + 5 Negation: >>> -f -x**2 - 2*x - 3 Subtraction: >>> f-g -2*x**3 - 2*x**2 - 2*x - 2 Evaluation: >>> g(10) 2345 >>> f(10) 123 Composition: >>> f(g(10)) 5503718 >>> g(f(10)) 3767618 Multiplication: >>> f*g 2*x**5 + 7*x**4 + 16*x**3 + 22*x**2 + 22*x + 15 >>> g*f 2*x**5 + 7*x**4 + 16*x**3 + 22*x**2 + 22*x + 15 Evaluation and Multiplication: >>> x = -1 >>> eval(str(g*f)) 4 >>> h=g*f >>> h(-1) 4 Negation and Multiplication: >>> -f*g -2*x**5 - 7*x**4 - 16*x**3 - 22*x**2 - 22*x - 15 Derivative: >>> h 2*x**5 + 7*x**4 + 16*x**3 + 22*x**2 + 22*x + 15 >>> h.deriv() 10*x**4 + 28*x**3 + 48*x**2 + 44*x + 22 I'm pretty sure all of the above is correct. I've put the code I have so far at: http://www.inetarena.com/~pdx4d/ocn/polynomial.py (Python source) http://www.inetarena.com/~pdx4d/ocn/polynomial.html (colorized HTML) Maybe we can improve/streamline the implementation somewhat -- and I wouldn't be surprised if someone, somewhere has implemented something very similar already. The hardest part was getting the algebraic strings to look pretty. Kirby From pdx4d@teleport.com Tue May 1 10:19:18 2001 From: pdx4d@teleport.com (Kirby Urner) Date: Tue, 1 May 2001 02:19:18 -0700 Subject: [Edu-sig] Algebra + Python In-Reply-To: <000801c0d21e$b6a21020$0802a8c0@KirbyUrner> Message-ID: <000901c0d21f$cd5cbd00$0802a8c0@KirbyUrner> > I've put the code I have so far at: > > http://www.inetarena.com/~pdx4d/ocn/polynomial.py (Python source) > http://www.inetarena.com/~pdx4d/ocn/polynomial.html (colorized HTML) Sorry, goofed the URLs: http://www.inetarena.com/~pdx4d/ocn/python/polynomial.py (Python source) http://www.inetarena.com/~pdx4d/ocn/python/polynomial.html (colorized HTML) Kirby From pdx4d@teleport.com Tue May 1 16:05:53 2001 From: pdx4d@teleport.com (Kirby Urner) Date: Tue, 01 May 2001 08:05:53 -0700 Subject: [Edu-sig] Algebra + Python In-Reply-To: <000901c0d21f$cd5cbd00$0802a8c0@KirbyUrner> References: <000801c0d21e$b6a21020$0802a8c0@KirbyUrner> Message-ID: <3.0.3.32.20010501080553.0139f9b8@pop3.norton.antivirus> One change I've already made to the Polynomial code (and uploaded): compute the string version only once, upon initialization, and then have __call__ simply evaluate that string, like this: def __init__(self, coeffs): self.coeffs = [] # ... skip some lines self.strview = self.express() # <-- new def __call__(self,x): return eval(self.strview) # short! def __repr__(self): return self.strview # no need to recompute def express(self): """ Represent self as an algebraic expression """ ... Kirby From schoen@loyalty.org Tue May 1 19:10:08 2001 From: schoen@loyalty.org (Seth David Schoen) Date: Tue, 1 May 2001 11:10:08 -0700 Subject: [Edu-sig] Algebra + Python In-Reply-To: <000801c0d21e$b6a21020$0802a8c0@KirbyUrner>; from pdx4d@teleport.com on Tue, May 01, 2001 at 02:11:30AM -0700 References: <20010430235401.N5636@zork.net> <000801c0d21e$b6a21020$0802a8c0@KirbyUrner> Message-ID: <20010501111008.Y5636@zork.net> Kirby Urner writes: > Could this be extended to a symbolic math implementation? At least, > could you implement compose, add, subtract, multiply, and divide methods > so that > > f.compose(g) > f.add(g) > > would work? > > -- > Seth David Schoen | And do not say, I will study when I > Temp. http://www.loyalty.org/~schoen/ | have leisure; for perhaps you will > down: http://www.loyalty.org/ (CAF) | not have leisure. -- Pirke Avot 2:5 > > ============ > > Sure. > > Compose was already implied in Brent's class, since f(10) returns > a number, and therefore so does g(f(10)) and g(f(10)). I was interested in having a polynomial returned explicitly, not just making a function that would have the same effect as composition. You could say I was hoping for a closed form. To implement that, I guess you'd want an exponentiation operator for polynomials (implement __pow__). > Using operator overriding, we can actually use + - and * for > addition, subtraction and multiplication (I haven't done divide): > > Definition and Representation: > > >>> f = Poly([1,2,3]) > >>> f > x**2 + 2*x + 3 > >>> g = Poly([2,3,4,5]) > >>> g > 2*x**3 + 3*x**2 + 4*x + 5 > > Negation: > >>> -f > -x**2 - 2*x - 3 > > Subtraction: > >>> f-g > -2*x**3 - 2*x**2 - 2*x - 2 > > Evaluation: > >>> g(10) > 2345 > >>> f(10) > 123 > > Composition: > >>> f(g(10)) > 5503718 > >>> g(f(10)) > 3767618 > > Multiplication: > >>> f*g > 2*x**5 + 7*x**4 + 16*x**3 + 22*x**2 + 22*x + 15 > >>> g*f > 2*x**5 + 7*x**4 + 16*x**3 + 22*x**2 + 22*x + 15 > > Evaluation and Multiplication: > >>> x = -1 > >>> eval(str(g*f)) > 4 > >>> h=g*f > >>> h(-1) > 4 > > Negation and Multiplication: > >>> -f*g > -2*x**5 - 7*x**4 - 16*x**3 - 22*x**2 - 22*x - 15 > > Derivative: > >>> h > 2*x**5 + 7*x**4 + 16*x**3 + 22*x**2 + 22*x + 15 > >>> h.deriv() > 10*x**4 + 28*x**3 + 48*x**2 + 44*x + 22 > > I'm pretty sure all of the above is correct. > > I've put the code I have so far at: > > http://www.inetarena.com/~pdx4d/ocn/polynomial.py (Python source) > http://www.inetarena.com/~pdx4d/ocn/polynomial.html (colorized HTML) Very nice. I need to upgrade to get -=, +=, and list comprehensions in my interepreter. (It was easy to use map instead of the list comprehension, but the list comprehension is easier to read.) I quickly noticed that you can't multiply a Poly by an integer, or add or subtract an integer. I think one approach would be to throw an if type(other)==type(3): other = Poly([other]) at the start of __add__ and __mul__. That worked for me, so that I could multiply a Poly by an integer or add or subtract an integer. You also might want to define __rmul__, __rsub__, and __radd__ in terms of __mul__, __sub__, and __add__ (polynomial multiplication and addition being commutative). -- Seth David Schoen | And do not say, I will study when I Temp. http://www.loyalty.org/~schoen/ | have leisure; for perhaps you will down: http://www.loyalty.org/ (CAF) | not have leisure. -- Pirke Avot 2:5 From schoen@loyalty.org Tue May 1 21:10:25 2001 From: schoen@loyalty.org (Seth David Schoen) Date: Tue, 1 May 2001 13:10:25 -0700 Subject: [Edu-sig] Algebra + Python In-Reply-To: <20010501111008.Y5636@zork.net>; from schoen@loyalty.org on Tue, May 01, 2001 at 11:10:08AM -0700 References: <20010430235401.N5636@zork.net> <000801c0d21e$b6a21020$0802a8c0@KirbyUrner> <20010501111008.Y5636@zork.net> Message-ID: <20010501131025.A5636@zork.net> Seth David Schoen writes: > Kirby Urner writes: > > > Could this be extended to a symbolic math implementation? At least, > > could you implement compose, add, subtract, multiply, and divide methods > > so that > > > > f.compose(g) > > f.add(g) > > > > would work? > > > > ============ > > > > Sure. > > > > Compose was already implied in Brent's class, since f(10) returns > > a number, and therefore so does g(f(10)) and g(f(10)). > > I was interested in having a polynomial returned explicitly, not just > making a function that would have the same effect as composition. You > could say I was hoping for a closed form. > > To implement that, I guess you'd want an exponentiation operator for > polynomials (implement __pow__). > > [...] > > I quickly noticed that you can't multiply a Poly by an integer, or add > or subtract an integer. I think one approach would be to throw an > > if type(other)==type(3): > other = Poly([other]) > > at the start of __add__ and __mul__. That worked for me, so that I > could multiply a Poly by an integer or add or subtract an integer. > > You also might want to define __rmul__, __rsub__, and __radd__ in > terms of __mul__, __sub__, and __add__ (polynomial multiplication > and addition being commutative). OK, I implemented __pow__, compose, __rmul__, __rsub__, and __radd__. The implementation of __pow__ does not take advantage of the binomial theorem or its higher-order generalizations, mostly because I don't know the higher-order generalizations. I also did the type check thing so that integer constants are automatically converted to polynomials where appropriate. That means it would be possible to implement __neg__ as "return self * -1". (This version gets rid of list comprehensions, +=, and -=, so it will run under 1.5.2.) http://www.loyalty.org/~schoen/polynomial.py >>> q = Poly([1,1]) >>> q x + 1 >>> q ** 2 x**2 + 2*x + 1 >>> q ** 3 x**3 + 3*x**2 + 3*x + 1 >>> q - 1 x >>> 1 - q -x >>> q * 2 2*x + 2 >>> 2 * q 2*x + 2 >>> It seems that it would be helpful to store the coefficients in reverse order. Then you could do for exponent in range(len(self.coeffs)): coeff = self.coeffs[exponent] # Some code that uses exponent and coeff goes here rather than counting down. -- Seth David Schoen | And do not say, I will study when I Temp. http://www.loyalty.org/~schoen/ | have leisure; for perhaps you will down: http://www.loyalty.org/ (CAF) | not have leisure. -- Pirke Avot 2:5 From pdx4d@teleport.com Tue May 1 22:13:29 2001 From: pdx4d@teleport.com (Kirby Urner) Date: Tue, 1 May 2001 14:13:29 -0700 Subject: [Edu-sig] Algebra + Python In-Reply-To: <20010501131025.A5636@zork.net> Message-ID: <000601c0d283$925274c0$0802a8c0@KirbyUrner> > OK, I implemented __pow__, compose, __rmul__, __rsub__, and __radd__. > The implementation of __pow__ does not take advantage of the binomial > theorem or its higher-order generalizations, mostly because I don't > know the higher-order generalizations. Great. I'd done a __pow__ earlier, but I like yours better. I also make sure the exponent is non-negative, as we're not promising to handle that kind of algebra here. > I also did the type check thing so that integer constants are > automatically converted to polynomials where appropriate. That means > it would be possible to implement __neg__ as "return self * -1". This is good -- I've incorporated it. > (This version gets rid of list comprehensions, +=, and -=, so it will > run under 1.5.2.) > > http://www.loyalty.org/~schoen/polynomial.py My most recent at: http://www.inetarena.com/~pdx4d/ocn/python/polynomial.html or same w/ .py extension for cut and paste source. Note that for commutative ops like __add__ and __mul__, you can just go __radd__ = __add__ and __rmul__ = __mul__ to create equivalent definitions. Only subtraction needs to be handled differently, because arg order matters. Also, once your enhancements are added, you really don't need a separate compose method (which is very cool). Just pass a polynomial as your "value of x" in the already-defined call method: >>> from polynomial import * >>> f = Poly([1,-3,2]) >>> g = Poly([1,3,0]) >>> f x**2 - 3*x + 2 >>> g x**2 + 3*x >>> f(g) # <--- symbolic composition x**4 + 6*x**3 + 6*x**2 - 9*x + 2 >>> g(f) # <--- symbolic composition x**4 - 6*x**3 + 16*x**2 - 21*x + 10 >>> f(g(10)) # <--- or you can do numeric evaluation 16512 >>> g(f(10)) 5400 I've put your name in lights in my program's marquee. Kirby From rob@jam.rr.com Wed May 2 04:55:00 2001 From: rob@jam.rr.com (rob@jam.rr.com) Date: Tue, 01 May 2001 22:55:00 -0500 Subject: [Edu-sig] Useless Python Message-ID: <3AEF8514.FDF7EAAE@jam.rr.com> I hope I'm not posting off-topic, but I'm new to the list. I maintain a small website dedicated to Python, featuring a section called Useless Python, which is the star of our little show. It consists of two things which I hope may be of potential value in the arena of Python and education. Each came about as a good idea set in motion on the Python Tutor email list. We allow people to provide solutions to ACM Programming Contest problems, which must be submitted in other languages such as Perl and C when submitting to the contest judges. We do not judge the submissions, but post them for the world to see. When I contacted the people behind the ACM site, I was told that they were delighted to hear about it and if we could provide a Python judge (which I took to mean software similar to that which they already use), they would be willing to add Python to the list of possible submission languages. Useless Python itself is a collection of scripts and similar selections sent in by anyone who cares to submit code. The general purpose is dual: to reduce the need to send long snips of source in emails to the tutor list, and to allow people to share scripts for beginners to look at. Novice and Intermediate level concepts are expressed in the code here. If there is any way that this resource could be made more useful for educational purposes, or improved in any way, we would welcome any requests or criticism. Oh, and if you have any odd programs you would share with people learning the language, please do. Please forgive my verbosity, Rob Andrews -- Useless Python! If your Python is this useless, we need you. http://www.lowerstandard.com/python/pythonsource.html From ping@lfw.org Wed May 2 05:37:45 2001 From: ping@lfw.org (Ka-Ping Yee) Date: Tue, 1 May 2001 23:37:45 -0500 (CDT) Subject: [Edu-sig] Python in the ACM ICPC In-Reply-To: <3AEF8514.FDF7EAAE@jam.rr.com> Message-ID: On Tue, 1 May 2001 rob@jam.rr.com wrote: > We allow people to provide solutions to ACM Programming Contest > problems, which must be submitted in other languages such as Perl and C > when submitting to the contest judges. We do not judge the submissions, > but post them for the world to see. When I contacted the people behind > the ACM site, I was told that they were delighted to hear about it and > if we could provide a Python judge (which I took to mean software > similar to that which they already use), they would be willing to add > Python to the list of possible submission languages. I am extremely excited to hear about this. I think Python should be one of the permitted languages (and it would instantly clean all the other teams' clocks, if i do say so myself). I'm familiar with the programming contest because i was on the Waterloo team a few years ago. We won, but we had a *major* advantage in that we chose to use vi and cc rather than Microsoft Visual C++, and i'm sure that if we'd had Python we would have done even better. Can you put me in touch with your ACM contact? I would like to make this happen. Thanks! -- ?!ng From guido@digicool.com Wed May 2 23:06:44 2001 From: guido@digicool.com (Guido van Rossum) Date: Wed, 02 May 2001 17:06:44 -0500 Subject: [Edu-sig] Wanted: a new edu-sig owner! Message-ID: <200105022206.RAA05119@cj20424-a.reston1.va.home.com> I'm looking for someone to take ownership of the edu-sig. You don't have to do much, except occasionally approve or reject posts that are caught by the spam filter. You also receive mail sent to the SIG owner; very rare. Anyone interested? While it's not much work, I just don't get to the requests in time myself. --Guido van Rossum (home page: http://www.python.org/~guido/) From pdx4d@teleport.com Wed May 2 22:48:20 2001 From: pdx4d@teleport.com (Kirby Urner) Date: Wed, 2 May 2001 14:48:20 -0700 Subject: [Edu-sig] Wanted: a new edu-sig owner! In-Reply-To: <200105022206.RAA05119@cj20424-a.reston1.va.home.com> Message-ID: <000001c0d351$9b4e8540$0802a8c0@KirbyUrner> I'll do it of no one else wants to. I'd like to see this list not die. Kirby -----Original Message----- From: edu-sig-admin@python.org [mailto:edu-sig-admin@python.org]On Behalf Of Guido van Rossum Sent: Wednesday, May 02, 2001 3:07 PM To: edu-sig@python.org Subject: [Edu-sig] Wanted: a new edu-sig owner! I'm looking for someone to take ownership of the edu-sig. You don't have to do much, except occasionally approve or reject posts that are caught by the spam filter. You also receive mail sent to the SIG owner; very rare. Anyone interested? While it's not much work, I just don't get to the requests in time myself. --Guido van Rossum (home page: http://www.python.org/~guido/) _______________________________________________ Edu-sig mailing list Edu-sig@python.org http://mail.python.org/mailman/listinfo/edu-sig From pdx4d@teleport.com Wed May 2 22:50:47 2001 From: pdx4d@teleport.com (Kirby Urner) Date: Wed, 2 May 2001 14:50:47 -0700 Subject: [Edu-sig] Algebra + Python In-Reply-To: <000601c0d283$925274c0$0802a8c0@KirbyUrner> Message-ID: <000101c0d351$f295f720$0802a8c0@KirbyUrner> The Poly class in polynomial.py has been streamlined and enchanced a bit, if anyone following this thread is curious: http://www.inetarena.com/~pdx4d/ocn/python/polynomial.html or .py for cut and pastable source Thanks to Brian Harvey on k12.ed.math for sharing his good ideas ( http://www.mathforum.com/epigone/k12.ed.math/blunpharthah ) Kirby From guido@digicool.com Thu May 3 01:31:15 2001 From: guido@digicool.com (Guido van Rossum) Date: Wed, 02 May 2001 19:31:15 -0500 Subject: [Edu-sig] Wanted: a new edu-sig owner! In-Reply-To: Your message of "Wed, 02 May 2001 14:48:20 MST." <000001c0d351$9b4e8540$0802a8c0@KirbyUrner> References: <000001c0d351$9b4e8540$0802a8c0@KirbyUrner> Message-ID: <200105030031.TAA05736@cj20424-a.reston1.va.home.com> > I'll do it of no one else wants to. Timothy Wilson was first, so he's it. If you want to do it together, coordinate with him. > I'd like to see this list not die. With your posting volume, it is in no danger to! :-) > Kirby --Guido van Rossum (home page: http://www.python.org/~guido/) From pdx4d@teleport.com Thu May 3 05:11:27 2001 From: pdx4d@teleport.com (Kirby Urner) Date: Wed, 2 May 2001 21:11:27 -0700 Subject: [Edu-sig] Wanted: a new edu-sig owner! In-Reply-To: <200105030031.TAA05736@cj20424-a.reston1.va.home.com> Message-ID: <000e01c0d387$207bbdc0$0802a8c0@KirbyUrner> >> I'll do it of no one else wants to. > >Timothy Wilson was first, so he's it. If you want to do it together, >coordinate with him. No, I'm happy to just have the one listowner. Great to have a volunteer. Congrats to Timothy Wilson. >> I'd like to see this list not die. > >With your posting volume, it is in no danger to! :-) Good, although it'd be not-so-good if I were the only active poster (but I'm not, so we're OK). Kirby From rnd@onego.ru Fri May 4 14:40:56 2001 From: rnd@onego.ru (Roman Suzi) Date: Fri, 4 May 2001 17:40:56 +0400 (MSD) Subject: [Edu-sig] Is it alive? Message-ID: Hello! I've just subscribed to this list and there is only silence here. Probably, edu-sig needs more publicity? Sorry for this test message. Sincerely yours, Roman A.Suzi -- - Petrozavodsk - Karelia - Russia - mailto:rnd@onego.ru - From jasonic@nomadicsltd.com Fri May 4 17:01:46 2001 From: jasonic@nomadicsltd.com (Jason Cunliffe) Date: Fri, 4 May 2001 12:01:46 -0400 Subject: [Edu-sig] Is it alive? References: Message-ID: <009601c0d4b3$8589a9c0$c3090740@megapathdsl.net> Welcome Roman! The list is definitely alive. Edu-Sig has a different rhythm from many lists. It is is not a stream or river.. Instead it comes in [unexpected] creative, thoughtful waves, sometimes Tsunami, and usually with very high signal-to-noise ratio. There is a lot to absorb, and do, between posts. I encourage your to take time to read the archives and to explore the work posted by Kirby Urner, Art, Jeff Elkner, Arthur Seigel and many others Not silence.. I think of it like the essential space between notes in piece of Music :-) Please introduce yourself - tell us what brings your here and your interests, projects etc.. cheers - Jason ___________________________________________________________ Jason CUNLIFFE = NOMADICS['Interactive Art and Technology'] ----- Original Message ----- From: "Roman Suzi" To: Sent: Friday, May 04, 2001 9:40 AM Subject: [Edu-sig] Is it alive? > Hello! > > I've just subscribed to this list and there is only silence here. > Probably, edu-sig needs more publicity? > > Sorry for this test message. > > Sincerely yours, Roman A.Suzi > -- > - Petrozavodsk - Karelia - Russia - mailto:rnd@onego.ru - From delza@alliances.org Fri May 4 17:06:43 2001 From: delza@alliances.org (Dethe Elza) Date: Fri, 04 May 2001 09:06:43 -0700 Subject: [Edu-sig] Is it alive? In-Reply-To: Message-ID: Oh, the list is very much alive, it just tends to work in burts. Someone will post an essay/idea/link/question that they find interesting, then we all join in. You just caught us in a lull. In any case, welcome to edu-sig. What brings you to python and edu-sig? --Dethe Dethe Elza Chief Mad Scientist Burning Tiger Technologies > From: Roman Suzi > Date: Fri, 4 May 2001 17:40:56 +0400 (MSD) > To: edu-sig@python.org > Subject: [Edu-sig] Is it alive? > > Hello! > > I've just subscribed to this list and there is only silence here. > Probably, edu-sig needs more publicity? > > Sorry for this test message. > > Sincerely yours, Roman A.Suzi > -- > - Petrozavodsk - Karelia - Russia - mailto:rnd@onego.ru - > > > > _______________________________________________ > Edu-sig mailing list > Edu-sig@python.org > http://mail.python.org/mailman/listinfo/edu-sig > From rnd@onego.ru Fri May 4 21:13:51 2001 From: rnd@onego.ru (Roman Suzi) Date: Sat, 5 May 2001 00:13:51 +0400 (MSD) Subject: [Edu-sig] About myself Message-ID: Hello! Well. I was asked to introduce myself and here is my informal self-introduction in the aspect of this SIG. As I hope to stay (at least lurk) here for long. Two years ago I conducted a class in a 10-11 forms (in Russia, these can be called "higher school" forms). And for no apparent reason I chose Python to do programming. (At that time I had no exposure to Python. I even thought, it was a kind of LISP or Schema or similarly AIsh.) I used Perl to do admin/text processing task, C for other small things. I learned Python for the purpose of teaching only, but it occured to be so magically powerful and attractive, that now (I changed jobs since then) it my primary language for most tasks. However, I was always interested in the teaching programming and it always intrigues me how one become a programmer. Yesterday you can't program, and today you feel, that you can! I can't tell that those programming classes were full success, but nevertheless, I made some observation of what young people expect from the CS/programming teacher. And I must tell you that I heard a lot of things like: "Why not {Delphi, Java, Pascal, C++}" from my pupils. Those usually did not understand what programming is about. On the contrary, those who listened made more progress. They were open to new ideas (not just their maximalist views) and were very supportive of what we did. * Really, I don't know why I am here. Probably, I want to listen to more stories (cases) and find something similar or dissimilar. But one thing I am very strong about: if we need to teach somebody programming, the Python is the choice No. 1. (Well, probably it depends on the age. For little-ones Logo is probably the choice or some special adopted environment). But for those who want to learn programming Python is very-very useful. (It's hard to switch from it to other languages, though ;-) But in schools we do not need to prepare programmers. It's all about development in the minds... OK. I joined this list as I feel that this direction could be forgotten, SIG closed, etc. IMHO, Python's one of primary goals is to be excellent for teaching programming. In today's school we are drifting more and more toward "user skills" (worsprocessing and such mouse-moving behaviour). This is what bothers me too, as I think those who is capable of programming need to have tools to learn and get successful results. This raises their IQ ;-) and improves understanding of life, whereever they will work. Still I do not see what can be done to the situation except with promoting Python to the advanced users and teachers. Unfortunately, I am no more in position where I can influence this process here (I worked in the teacher's retraining institute's IT center), so probably my presence here will not be too visible (I do not have much time to do something real, usually I just generate lots of ideas ;-) I read some of the archives. Probably I could add something later to share with others. (I am also a participant of Seul/EDU (Simple End User Linux, educational aspect. Python Edu-SIG /\ Seul-EDU != []. And a moderator of relcom.education newsgroup. So, if there are some need to communicate some ideas/offers/questions/queries with the later, you can ask me. I will try to translate it into Russian and put it into there. In fact, in the near future I want to prepare an "advertizement" of Python (and free software) for relcom.education. That is why I also want to listen here. Wow. It was quite lenthy explanation! (I do not have a web-page, at least updated less than 4 years ago ;-) Sincerely yours, Roman Suzi -- _/ Russia _/ Karelia _/ Petrozavodsk _/ rnd@onego.ru _/ _/ Friday, May 04, 2001 _/ Powered by Linux RedHat 6.2 _/ _/ "A program without bugs is obsolete." _/ From dcraig@cris.com Fri May 4 22:58:58 2001 From: dcraig@cris.com (dcraig) Date: Fri, 4 May 2001 14:58:58 -0700 Subject: [Edu-sig] Setup python path on Windows 98 Message-ID: <001b01c0d4e5$6f11a300$7dbab0d0@p8d0i5> This is a multi-part message in MIME format. ------=_NextPart_000_0018_01C0D4AA.BF870680 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Help! I have been learning python using idle as the editor and it's = great. My new problem is setting up the environmental variables (path) = necessary to run it from the command line in MS-DOS. I am using WIN 98 = and the Python files are located at C:\Python20. Thanks for any help. =20 Dave Craig dcraig@cris.com ------=_NextPart_000_0018_01C0D4AA.BF870680 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Help!  I have been learning python = using idle=20 as the editor and it's great.  My new problem is setting up the=20 environmental variables (path) necessary to run it from the command line = in=20 MS-DOS.  I am using WIN 98 and the Python files are located at=20 C:\Python20.  Thanks for any help. 
 
Dave Craig
dcraig@cris.com
 
 
------=_NextPart_000_0018_01C0D4AA.BF870680-- From pdx4d@teleport.com Sat May 5 05:28:09 2001 From: pdx4d@teleport.com (Kirby Urner) Date: Fri, 4 May 2001 21:28:09 -0700 Subject: [Edu-sig] re: throwaway code (a.k.a. personal-use scribbling) In-Reply-To: Message-ID: <000201c0d51b$cac7d120$0802a8c0@KirbyUrner> In a recent thread, we were looking at source code for doing polynomial expressions, with both a symbolic and number crunching aspect. Thanks to Brent, the polynomial quickly became an object, which allowed for operator overloading of multiply, add, subtract and power (but not divide). Example usage: >>> from polynomial import * >>> p1 = Poly([1,2,3]) >>> p2 = Poly([2,0,0]) >>> p1 x**2 + 2*x + 3 >>> p2 2*x**2 >>> p1*p2 2*x**4 + 4*x**3 + 6*x**2 >>> p2(10) 200 >>> p1+p2 3*x**2 + 2*x + 3 >>> p2.deriv() 4*x I think such source code is illustrative of a genre I'd call "throwaway code". In the old days, time on computers was hard to come by, programming was more difficult and for the highly skilled, and so if you had the opportunity to write some code, the economics of the situation often dictated that you do so "for the ages". In other words, your end-user was someone you maybe will never meet, but because you've written a set of FORTRAN functions for manipulating matrices, and put them in a library someplace, along with documentation, that end user will be able to take advantage of your precious skills (and FORTRAN's power). Given your code might get pulled in by some larger system in charge of monitoring nuclear power plants, or launching a rocket, it'd better be robust and full of error trapping -- make your code as bullet proof and "ready for anything" as possible. That's the opposite of throwaway code, and the need for it hasn't gone away by any means. We all depend on such robust, archived, documented and (if we're lucky) open source assets at every turn. On the other hand, computer time is now very cheap, programming is relatively easy, and it's no longer anti-economic to write code with primarily one end-user in mind -- oneself. It's more of a scratch pad approach. You scribble code as you would math notations to perform a calculation, with the added benefit that your module is more easily saved and re-run later. simplematrix.py is another example of throwaway code. It looks a lot like polynomial.py in that it contains essentially one list of data, and overrides * ** + and -. No determinant or inverse here [in the works]. This is not a commercial grade module, optimized for speed, and generic enough for any end user. It's more illustrative of the kind of thing a student could whip out in a relatively short time. Example usage: >>> from simplematrix import Matrix >>> a = Matrix([[1,2],[3,4]]) >>> a [1, 2] [3, 4] >>> b = Matrix([[-1,0],[0,-1]]) >>> b [-1, 0] [0, -1] >>> a*b [-1, -2] [-3, -4] >>> a**2 [7, 10] [15, 22] >>> a+2 [3, 4] [5, 6] "Math through programming" is very tied to this "throwaway code" concept, because the focus is on the math, the mathematical concepts, and not on all the claptrap that makes a program commercial grade and ready for prime time. We don't assume an anonymous and/or naive and/or malicious end user who might keep passing illegal arguments. We don't necessarily optimize for speed (which might mean coding in C and using Python as a front end) because our goal is transparency: it's more important to be able to see/read the code and understand what principles it embodies. We therefore to use "pure Python" whenever possible. One thesis I've advanced at my website is that the computer science notion of "object" is going to percolate more and more through math world, such that we'll be spontaneously thinking of polynomials and matrices as objects (vectors, quaternions, sets, functions -- all are objects). One difference between a function and an object is that an object saves persistent state data internally. Functions are more "pass through" and the feeling you get is that data is out in some logical space, there to be operated upon by functions, but functions don't contain data, and data have no clue about functions. With objects, this changes: data is may be internal to objects, which is also where the functionality is contained. Instead of "functions working on data", we have "objects containing both data and functions, and working with one another". It may be a subtle shift, but I think one that's destined to affect mathematics, not just computer science. So in Python, using throwaway code, now that we have both Poly objects (polynomials) and Matrix objects, with no additional code, we can create some synergy: pass a matrix to a polynomial for evaluation, or populate a matrix with polynomials. This illustrates the power of objects, and why we might want to teach Python in complement with mathematics -- because it helps us conceptualize the math: >>> p1 x**2 + 2*x + 3 >>> p2 2*x**2 >>> a [1, 2] [3, 4] >>> # passing matrix object to a polynomial object >>> p1(a) [12, 17] [24, 33] >>> # populating a matrix w/ polynomials >>> c = Matrix([[p1,p2],[p2,-p1]]) >>> c [x**2 + 2*x + 3, 2*x**2] [2*x**2, -x**2 - 2*x - 3] >>> c**2 [5*x**4 + 4*x**3 + 10*x**2 + 12*x + 9, 0] [0, 5*x**4 + 4*x**3 + 10*x**2 + 12*x + 9] # passing a matrix populated with polynomials to a polynomial >>> p2(c) [10*x**4 + 8*x**3 + 20*x**2 + 24*x + 18, 0] [0, 10*x**4 + 8*x**3 + 20*x**2 + 24*x + 18] Kirby Notes: polynomial.py http://www.inetarena.com/~pdx4d/ocn/python/polynomial.html (or .py) simplematrix.py http://www.inetarena.com/~pdx4d/ocn/python/simplematrix.html (or .py) Re: OOP affecting math http://www.inetarena.com/~pdx4d/ocn/oopalgebra.html From Seamus.Venasse@polaris.ca Sat May 5 08:08:58 2001 From: Seamus.Venasse@polaris.ca (Seamus.Venasse) Date: Sat, 5 May 2001 00:08:58 -0700 Subject: [Edu-sig] Setup python path on Windows 98 In-Reply-To: <001b01c0d4e5$6f11a300$7dbab0d0@p8d0i5> Message-ID: <000101c0d532$41e6a6d0$d1e555c7@POLARIS.CA> This is a multi-part message in MIME format. ------=_NextPart_000_0002_01C0D4F7.9587CED0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit So add ";c:\python20" to end of the line that begins with "PATH=" in your c:\autoexec.bat file. -----Original Message----- From: edu-sig-admin@python.org [mailto:edu-sig-admin@python.org]On Behalf Of dcraig Sent: May 4, 2001 2:59 PM To: edu-sig@python.org Subject: [Edu-sig] Setup python path on Windows 98 Help! I have been learning python using idle as the editor and it's great. My new problem is setting up the environmental variables (path) necessary to run it from the command line in MS-DOS. I am using WIN 98 and the Python files are located at C:\Python20. Thanks for any help. Dave Craig dcraig@cris.com ------=_NextPart_000_0002_01C0D4F7.9587CED0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
So add=20 ";c:\python20" to end of the line that begins with "PATH=3D" in your=20 c:\autoexec.bat file. 
-----Original Message-----
From: = edu-sig-admin@python.org=20 [mailto:edu-sig-admin@python.org]On Behalf Of = dcraig
Sent:=20 May 4, 2001 2:59 PM
To: = edu-sig@python.org
Subject:=20 [Edu-sig] Setup python path on Windows 98

Help!  I have been learning = python using=20 idle as the editor and it's great.  My new problem is setting up = the=20 environmental variables (path) necessary to run it from the command = line in=20 MS-DOS.  I am using WIN 98 and the Python files are located at=20 C:\Python20.  Thanks for any help. 
 
Dave Craig
dcraig@cris.com
 
 
------=_NextPart_000_0002_01C0D4F7.9587CED0-- From pdx4d@teleport.com Sun May 6 17:30:11 2001 From: pdx4d@teleport.com (Kirby Urner) Date: Sun, 6 May 2001 09:30:11 -0700 Subject: [Edu-sig] Algebra + Python Message-ID: <000501c0d649$d32d6c60$0802a8c0@KirbyUrner> Getting Poly, Fraction and Matrix to interoperate has been fun. I get into these operator precedence situations where two objects have different implementations of __mul__, so the __rmul__ of one triggers where what I want is the __mul__ of the other. So I end up doing type checking to force the result I want. For example, Poly knows how to coerce a Fraction into becoming a polynomial of degree 0, but Fraction shouldn't ever try to change a polynomial into a Fraction. So when it comes to a Fraction * a Poly, it's the Poly version of * that takes precedence over the Fraction version -- but only because I type check, e.g. def __mul__(self,n): if type(n).__name__=='instance': if n.__class__.__name__ == "Poly": print "Fraction -> Poly" return n.__mul__(self) if n.__class__.__name__ == "Matrix": print "Fraction -> Fraction" return n.__mul__(self) f = self.mkfract(n) return Fraction(self.numer*f.numer, self.denom*f.denom) Anyway, below is an example of a session at the command line: >>> C = Matrix([map(Fraction,[1,1,1]), map(Fraction,[2,3,4]), map(Fraction,[5,8,9])]) >>> C [1, 1, 1] [2, 3, 4] [5, 8, 9] >>> C.inverse() [(5.0/2), (1.0/2), (-1.0/2)] [-1.0, -2.0, 1.0] [(-1.0/2), (3.0/2), (-1.0/2)] >>> A = Matrix([[Poly([1,-3],'t'),2], [Fraction(1,2),Poly([1,-4],'t')]]) >>> A [t - 3, 2] [(1/2), t - 4] >>> A.det() # determinant of A x**2 - 7*x + 11 >>> I = Matrix([[1,0,0],[0,1,0],[0,0,1]]) # identity matrix >>> t = Poly([1,0],'t') # t >>> t*I [t, 0, 0] [0, t, 0] [0, 0, t] >>> A = Matrix([[1,1,2],[0,3,2],[1,3,9]]) >>> A [1, 1, 2] [0, 3, 2] [1, 3, 9] >>> (t*I-A).det() # characteristic polynomial of A t**3 - 13*t**2 + 31*t - 17 >>> p=(t*I-A).det() # t = 10 >>> p(10) -7 Note that polynomials now optionally permit some variable other than x. However, you can't multiply two polynomials with differing variables and expect their identities to stay separate. Getting evaluation to work no matter the letter required a small modification to __call__ in polynomial.py. I've stowed polynomial,pyfraction and simplematrix as a package called mathobjects. simplematrix is dependent on ciphers.py however, which was my last project, and which has to do with permutations in the context of group theory and cryptography. A simple way to compute the determinant is to add the signed products of all permutations of matrix elements, choosing one from each row (a total of row! possibilities). ciphers.py is in charge of returning a list of all those possibilities (breaks down when n is double-digit or higher -- but that's OK, as this is throwaway code)). Kirby From ping@lfw.org Sun May 6 20:43:29 2001 From: ping@lfw.org (Ka-Ping Yee) Date: Sun, 6 May 2001 14:43:29 -0500 (CDT) Subject: [Edu-sig] Algebra + Python In-Reply-To: <000501c0d649$d32d6c60$0802a8c0@KirbyUrner> Message-ID: Hi, Kirby. On Sun, 6 May 2001, Kirby Urner wrote: > For example, Poly knows how to coerce a Fraction into becoming > a polynomial of degree 0, but Fraction shouldn't ever try to > change a polynomial into a Fraction. So when it comes to > a Fraction * a Poly, it's the Poly version of * that takes > precedence over the Fraction version -- but only because I > type check, e.g. > > def __mul__(self,n): > if type(n).__name__=='instance': > if n.__class__.__name__ == "Poly": > print "Fraction -> Poly" > return n.__mul__(self) > if n.__class__.__name__ == "Matrix": > print "Fraction -> Fraction" > return n.__mul__(self) > > f = self.mkfract(n) > return Fraction(self.numer*f.numer, > self.denom*f.denom) Python has a built-in function "isinstance" to help you do this. In addition, my personal preference would be to simply use * instead of calling __mul__ explicitly, although that's more of a style issue. Anyway here's what i would write: class Fraction: ... def __mul__(self, n): if isinstance(n, Poly) or isinstance(n, Matrix): return n * self f = self.mkfract(n) return Fraction(self.numer * f.numer, self.denom * f.denom) Very nice work, by the way! -- ?!ng From pdx4d@teleport.com Mon May 7 04:12:58 2001 From: pdx4d@teleport.com (Kirby Urner) Date: Sun, 6 May 2001 20:12:58 -0700 Subject: [Edu-sig] Algebra + Python In-Reply-To: Message-ID: <000901c0d6a3$9e974160$0802a8c0@KirbyUrner> > = Ka-Ping Yee = Kirby > Python has a built-in function "isinstance" to help you do this. Yes, that cleans up my syntax quite a bit. I'd played around with isinstance before and drew some wrong conclusions -- it's more useful than I'd realized. The only advantage of doing it the other way is my pyfractions module could remain ignorant of Poly and Matrix objects and yet still refer back to their methods: i.e. n.__class__.__name__ == "Matrix" can be truth-tested without the global name Matrix having any meaning in this module (pyfraction). But it's a very small price to pay to put: from simplematrix import Matrix (and similar for Poly) at the top (since I'm testing for these kinds of object, I might as well make this module aware of them). Note: I've also added Sqmatrix as a subclass of Matrix (for square matrices), as so many matrix ops only make sense when applied to square matrices. > In addition, my personal preference would be to simply use * > instead of calling __mul__ explicitly, although that's more of > a style issue. Anyway here's what i would write: I was hesitant to do this because the reason I'm in Fraction's __mul__ method in the first place is the Matrix or Poly __mul__ method was ignored in favor of Fraction's in some "poly * fraction" or "fraction * matrix" type expression. By putting: print -> "Fraction" in Fraction's __mul__, I can see when it's being called: >>> I = Sqmatrix([[1,0,0],[0,1,0],[0,0,1]]) >>> f = Fraction(1,2) >>> f*I -> Fraction [(1/2), 0, 0] [0, (1/2), 0] [0, 0, (1/2)] >>> I*f [(1/2), 0, 0] [0, (1/2), 0] [0, 0, (1/2)] So Fraction is trapping these cases and forcing us to use the passed object's __mul__ method instead of Fraction's. I was thinking that using * in place of n.__mul__ might just trigger a repeat of the same situation (i.e. might beget the same ambiguity I'm coding to avoid).... But so far, going with * is working OK. You must have clearer insight into this issue, or at least aren't quite so confused. Is it the case that __mul__ always takes precedence over __rmul__ if both are defined? That would explain the above I think. > > class Fraction: > ... > def __mul__(self, n): > if isinstance(n, Poly) or isinstance(n, Matrix): > return n * self > f = self.mkfract(n) > return Fraction(self.numer * f.numer, self.denom > * f.denom) > > Very nice work, by the way! Thanks. I appreciate the tips -- thanks to which, I'm gradually getting more proficient with this nifty language. > > -- ?!ng Kirby From dajoy@softhome.net Tue May 8 00:14:44 2001 From: dajoy@softhome.net (Daniel Ajoy) Date: Mon, 7 May 2001 18:14:44 -0500 Subject: [Edu-sig] Algebra + Python Message-ID: On 7 May 01, at 12:01, edu-sig-request@python.org wrote: > A simple way to compute the determinant is to add the signed > products of all permutations of matrix elements, choosing one > from each row (a total of row! possibilities). ciphers.py is > in charge of returning a list of all those possibilities Does that work for matrices 4x4 ? I ask because it didn't work for me. I have an algorithm that gives me the permutation in this order for a 3 row matrix: [[0 1 2] [0 2 1] [1 2 0] [1 0 2] [2 0 1] [2 1 0]] and this for a 4 row matrix: [[0 1 2 3] [0 1 3 2] [0 2 3 1] [0 2 1 3] [0 3 1 2] [0 3 2 1] [1 2 3 0] [1 2 0 3] [1 3 0 2] [1 3 2 0] [1 0 2 3] [1 0 3 2] [2 3 0 1] [2 3 1 0] [2 0 1 3] [2 0 3 1] [2 1 3 0] [2 1 0 3] [3 0 1 2] [3 0 2 1] [3 1 2 0] [3 1 0 2] [3 2 0 1] [3 2 1 0]] Is that the same order you get with your algorithm. For the 3 row matrix I change signs like this (using the same order as above): [1 -1 1 -1 1 -1] and for the 4 row matrix something very similar: [1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1] Am I wrong in this step? using this this sequence of signs? The funny thing is that it works nicely for matrices (2x2) and (3x3). Daniel From pdx4d@teleport.com Tue May 8 06:15:02 2001 From: pdx4d@teleport.com (Kirby Urner) Date: Mon, 7 May 2001 22:15:02 -0700 Subject: [Edu-sig] Algebra + Python In-Reply-To: Message-ID: <001401c0d77d$d635ae60$0802a8c0@KirbyUrner> > and this for a 4 row matrix: > > [[0 1 2 3] [0 1 3 2] [0 2 3 1] [0 2 1 3] [0 3 1 2] [0 3 2 1] > [1 2 3 0] > [1 2 0 3] [1 3 0 2] [1 3 2 0] [1 0 2 3] [1 0 3 2] [2 3 0 1] [2 3 1 0] > [2 0 1 3] [2 0 3 1] [2 1 3 0] [2 1 0 3] [3 0 1 2] [3 0 2 1] [3 1 2 0] > [3 1 0 2] [3 2 0 1] [3 2 1 0]] > > Is that the same order you get with your algorithm. I get those same permutations, although not in the same order. Mine are in numeric order, as if the above were 4-digit numbers. > and for the 4 row matrix something very similar: > > [1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1] > > Am I wrong in this step? using this this sequence of signs? Below I'm pairing my 24 permutations with their corresponding signs... >>> zip(permutations(4),map(sign,permutations(4))) [('0123', 1), ('0132', -1), ('0213', -1), ('0231', 1), ('0312', 1), ('0321', -1), ('1023', -1), ('1032', 1), ('1203', 1), ('1230', -1), ('1302', -1), ('1320', 1), ('2013', 1), ('2031', -1), ('2103', -1), ('2130', 1), ('2301', 1), ('2310', -1), ('3012', -1), ('3021', 1), ('3102', 1), ('3120', -1), ('3201', -1), ('3210', 1)] I see at least one discrepancy -- the last entry. I've got 3210 signed 1, but you have it signed -1. The way I get the sign is to ask how many of the digits subsequent to each digit are lower, i.e. out of order. Another way of putting it: for all i before j, how many times is i>j. Take 3210: 3 comes before 2,1,0 and is greater than all of them, so that's 3 occurances. Then 2 is greater than both 1 and 0, so that's two more for 5, and then 1 is greater than 0, so one more for 6. If the count is even, sign is positive or 1, if count is odd, sign is negative. Here's my code for sign, given a permutation is a string of the form '3210' (this algorithm will stop working with double-digit matrix dimensions -- would need to be modified): def sign(perm): """ return the sign of a permutation = -1 if odd number of transpositions = 1 if even """ trans = 0 for k in perm[:-1]: for j in perm[perm.index(k)+1:]: if int(k)>int(j): trans += 1 if trans%2==0: return 1 else: return -1 > The funny thing is that it works nicely for matrices (2x2) and > (3x3). > > Daniel From sheila@thinkspot.net Tue May 8 07:58:52 2001 From: sheila@thinkspot.net (Sheila King) Date: Mon, 07 May 2001 23:58:52 -0700 Subject: [Edu-sig] Intro and question: assignments/projects for year end Message-ID: <101930C39A6@kserver.org> Hello, My name is Sheila King. I'm a high school AP Computer Science teacher. Heh. AP Exam is tomorrow! I've been learning Python for myself since January. If you read comp.lang.python or the Python Tutor List, you've seen my posts there, probably. Anyway, for the last two or so weeks of the school year, what I'm going to have my AP Comp Sci students do is this: They get a choice of two possible types of projects: (1) CMU graphics. (this is what all of my students did last year.) (2) Learn Python. I must've given a pretty convincing speech about Python, because 10 of my 17 students picked to do Python. I was surprised. I thought most of them would want to do a graphics project. (Last year's class wrote a number of different games.) Anyhow...here's my question: I'm looking for suggested projects or programming problems for my students. They have had a year of C++, and some of them are excellent. Some are only barely proficient. I know the good ones will pick up Python easily. I hope the others will be able to do so, as well. It's going to be sort of independent study. (I'm putting several HTML tutorials on their desktops...) If they only have about two weeks to "learn" Python, and write a small program or two, what types of things could I have them do? We won't have time to get into GUIs. These can't be very ambitious projects, due to the limited amount of time. -- Sheila King http://www.thinkspot.net/sheila/ http://www.k12groups.org/ From schoen@loyalty.org Tue May 8 08:29:17 2001 From: schoen@loyalty.org (Seth David Schoen) Date: Tue, 8 May 2001 00:29:17 -0700 Subject: [Edu-sig] Intro and question: assignments/projects for year end In-Reply-To: <101930C39A6@kserver.org>; from sheila@thinkspot.net on Mon, May 07, 2001 at 11:58:52PM -0700 References: <101930C39A6@kserver.org> Message-ID: <20010508002917.K5636@zork.net> Sheila King writes: > Hello, > > My name is Sheila King. I'm a high school AP Computer Science teacher. Heh. AP > Exam is tomorrow! I've been learning Python for myself since January. If you > read comp.lang.python or the Python Tutor List, you've seen my posts there, > probably. > > Anyway, for the last two or so weeks of the school year, what I'm going to have > my AP Comp Sci students do is this: > They get a choice of two possible types of projects: > (1) CMU graphics. (this is what all of my students did last year.) > (2) Learn Python. > > I must've given a pretty convincing speech about Python, because 10 of my 17 > students picked to do Python. I was surprised. I thought most of them would want > to do a graphics project. (Last year's class wrote a number of different games.) > > Anyhow...here's my question: > I'm looking for suggested projects or programming problems for my students. > > They have had a year of C++, and some of them are excellent. Some are only > barely proficient. I know the good ones will pick up Python easily. I hope the > others will be able to do so, as well. It's going to be sort of independent > study. (I'm putting several HTML tutorials on their desktops...) > > If they only have about two weeks to "learn" Python, and write a small program > or two, what types of things could I have them do? We won't have time to get > into GUIs. These can't be very ambitious projects, due to the limited amount of > time. How much did they understand OO from C++? Some of the neat things Kirby Urner has come up with here really show off the power of objects and state -- and there are lots of possibilities for "create an object which models the behavior of..." (something from mathematics or language or everyday experience). _Structure and Interpretation of Computer Programs_ has some great exercises and projects -- they are oriented toward Scheme, but some of them transfer well. Python has plenty of high-level data types and procedures. A friend of mine wrote a program which uses a phonetic dictionary to find haiku which happen to appear in regular prose text -- for example, in a speech by Richard Stallman, One person gains one dollar by destroying two dollars' worth of wealth. Writing parsers and interpreters can be interesting. _SICP_ spends a lot of time on this, partly to reinforce the idea that interpreters and compilers are "just" computer programs. You could do a "how would you design a computer language?" or "how would you design a program which could interpret this toy language?". Symbolic algebra -- parse expressions into trees, try to find ways to manipulate them (simplify, factor, expand, evaluate, add, subtract, or multiply them; do symbolic differentiation if students know what it is). Give a specification for a Turing machine and have students write a simulator for it. Then have them see if they can write some simple Turing machine programs. (They don't have to prove universality, or equivalence to other computing models, or that there are non-computable numbers -- although it could be nice to talk about this, because many high school classes spend more time on "how to compute particular things" than "what can be computed".) Given urllib, write a web browser (text only). Conway's Game of Life. Core War. A stack-based calculator -- push, pop, operations. You could then also talk about, or have students talk about, RPN. Can they see how to convert between RPN and infix? Why RPN doesn't need parentheses? Compress images (given in the form of arrays, like a list of lists of integers) or text (given in the form of a string, or a file that you open and then read the contents of). Maybe students can discuss how they would handle compression and see who can come up with the most effective techniques. (In junior high school I re-discovered run-length encoding, but I never would have figured out Huffman coding or LZW or anything like that.) You could have a contest to see who could come up with the most efficient lossless compressor. (I know it wouldn't be very good compared to gzip, but it would still be interesting to see what ideas occur to students, and whether they can correctly implement _some_ original lossless compressor and its corresponding decompressor.) Some of those may be very ambitious; it depends on your students. I hope they're at least interesting. -- Seth David Schoen | And do not say, I will study when I Temp. http://www.loyalty.org/~schoen/ | have leisure; for perhaps you will down: http://www.loyalty.org/ (CAF) | not have leisure. -- Pirke Avot 2:5 From hei@adtranzsig.de Tue May 8 09:15:27 2001 From: hei@adtranzsig.de (Dirk-Ulrich Heise) Date: Tue, 8 May 2001 10:15:27 +0200 Subject: [Edu-sig] Intro and question: assignments/projects for year end References: <101930C39A6@kserver.org> <20010508002917.K5636@zork.net> Message-ID: <004001c0d797$0a4ff660$13ec1fc2@adtranzsig.de> -----Ursprüngliche Nachricht----- Von: "Seth David Schoen" > Given urllib, write a web browser (text only). > That's the best suggestion, IMHO - so they'll have a web browser for themselves that's not stinking slow and hogs all memory... (I'd like to have one myself) Dirk Heise What's a life and where do i get one? From jasonic@nomadicsltd.com Tue May 8 11:03:52 2001 From: jasonic@nomadicsltd.com (Jason Cunliffe) Date: Tue, 8 May 2001 06:03:52 -0400 Subject: [Edu-sig] Intro and question: assignments/projects for year end References: <101930C39A6@kserver.org> Message-ID: <001d01c0d7a6$2fe2a760$c3090740@megapathdsl.net> Hi Sheila Congratulations.. I would love to know what _did_ you say in your speech? Here are my enthusiatic, (but propably over ambitious) suggestions. I think since time is so short, you may be better off helping them enagage in the wide world of Python, and give them motivation and basic skills so they can keep going by themselves with it. A. INSPIRATION: TOOLKITS & MODULES One one the great virtues of Python is its community and the scope of contributed nmodules. So I think one appraoch might be to explore with your students The Vaults of Parnassus http://www.vex.net/parnassus This will expose them to the possibilities and also offer endless examples of code. Perhaps pick something simple and show them how to make use of it. This is valuable skill which will carry them way beyond the precious few weeks they have allocated. I think learning to read real code is half the battle. Fortuntately readability is Python's #1 virtue once you get past those __wierd__ __words__. Books and tutorials often fail because as a newbie one does not understnd where they are going or why. Or it just plain boring! As babies we did not 'study' grammer, we are born into a world of bustling taklative adults with whom we are motivated to communicate, by love hunger expression etc. This is 'natural learning' and is incredibly effective since the wrl began. How thento induce even a littlw of that in students learning another Human langauge [..in this instance Python]? B. FEEDBACK Do something which allows interactive feedback - some visible/audible/tangible results. Perhaps graphic, perhaps sound, text manipulation or web related. Not as distraction but to see how one can use python to build up things and connect them to others. C. RESOURCES Among the wonderful modules you should definitely stop at Kirby's pages. Check out VPython http://virtualphoton.pc.cc.cmu.edu/projects/visual/ 2 weeks background ok. PIL - Python Imaging Library http://www.pythonware.com/products/pil/ Once installed you can immediately start manipulating images with minimal Python experience. This very manageable. PIL has good clear PDF docs you print out. 2 weeks background ok. Have fun with language. Perhaps there are some poets in the class.. http://www.cs.brandeis.edu/~steele/sources/wordnet-python.html SNACK http://www.speech.kth.se/snack/ The Snack Sound Toolkit is designed to be used with a scripting language such as Tcl/Tk or Python. Using Snack you can create create powerful multi-platform audio applications with just a few lines of code. MIDI http://www2.hku.nl/~simon2/python/ BLENDER http://www.blender.nl 3D Modelling and animation software with game engine and a Python API: http://www.janw.gothere.uk.com/documentation.html Blender itself woudl take up all your time to learn, but despite theis there is great value in discussing it with your sutdents a littel and revierwing some of the excellent but eclectic Python materials forit. I imagina at leat one of your tudents will keep going after the course is over: Start here =>a nice list of scripts: http://honk.physik.uni-konstanz.de/~strubi/3d/python/ for example in 15 minutes you can look over the illustrated scripts at: http://home.iae.nl/users/exwhale/blender/main/scripts.html take even a sinmple one for dsicussion: Some of the Python Blender sites are very good intro tutuorial sites, becuse they are writeen by motivated oung hackers taching each other. they don't suffer from too many years of CS training.. some are very well illustrated and broken down into good clear step by step common language. I recommend you to look at the bilingual pages at http://jmsoler.free.fr/didacticiel/blender/tutor/english/index_prog_python.h tm and then rad through the sequence http://jmsoler.free.fr/didacticiel/blender/tutor/english/python_script01.htm http://jmsoler.free.fr/didacticiel/blender/tutor/english/python_script02.htm etc.. An another is Crystal Space http://crystal.linuxgames.com/ 0.14 - A free portable 3D engine written in C++, with python scripting support. Adn lastly.. A 16-year old LA hacker's page http://jesswei.tripod.com/programs.html hth ./Jason ___________________________________________________________ Jason CUNLIFFE = NOMADICS['Interactive Art and Technology'] ----- Original Message ----- From: "Sheila King" To: Sent: Tuesday, May 08, 2001 2:58 AM Subject: [Edu-sig] Intro and question: assignments/projects for year end > Hello, > > My name is Sheila King. I'm a high school AP Computer Science teacher. Heh. AP > Exam is tomorrow! I've been learning Python for myself since January. If you > read comp.lang.python or the Python Tutor List, you've seen my posts there, > probably. > > Anyway, for the last two or so weeks of the school year, what I'm going to have > my AP Comp Sci students do is this: > They get a choice of two possible types of projects: > (1) CMU graphics. (this is what all of my students did last year.) > (2) Learn Python. > > I must've given a pretty convincing speech about Python, because 10 of my 17 > students picked to do Python. I was surprised. I thought most of them would want > to do a graphics project. (Last year's class wrote a number of different games.) > > Anyhow...here's my question: > I'm looking for suggested projects or programming problems for my students. > > They have had a year of C++, and some of them are excellent. Some are only > barely proficient. I know the good ones will pick up Python easily. I hope the > others will be able to do so, as well. It's going to be sort of independent > study. (I'm putting several HTML tutorials on their desktops...) > > If they only have about two weeks to "learn" Python, and write a small program > or two, what types of things could I have them do? We won't have time to get > into GUIs. These can't be very ambitious projects, due to the limited amount of > time. From dyoo@hkn.eecs.berkeley.edu Tue May 8 11:27:05 2001 From: dyoo@hkn.eecs.berkeley.edu (Daniel Yoo) Date: Tue, 8 May 2001 03:27:05 -0700 (PDT) Subject: [Edu-sig] Intro and question: assignments/projects for year end In-Reply-To: <101930C39A6@kserver.org> Message-ID: > If they only have about two weeks to "learn" Python, and write a small program > or two, what types of things could I have them do? We won't have time to get > into GUIs. These can't be very ambitious projects, due to the limited amount of > time. If they can't do GUI's, let's see if we can write something that lets your students play around with graphics. For the CS3 class, the last 2 weeks of the introductory CS class covers a barrage of topics, including fractals: http://www-inst.EECS.Berkeley.EDU/~cs3/lectures/l23/l23.html To make this accessible to Scheme students, we provide them with a simplified interface to a Scheme canvas, using a teachpack for DrScheme: http://www-inst.EECS.Berkeley.EDU/~cs3/misc/graphics-teachpack.scm which allows them to play around with fractal programs without worrying too much: all they need to really remember is (clear-graphics) (draw-line) which still gives them enough power to draw pretty intricate looking fractals. I've almost completed a version in Python that works similarly to the Scheme teachpack. Give me a day or so. *grin* Ideally, a student can do something like: ### from graphics import * clearGraphics() drawLine(0, 0, 100, 0) drawLine(100, 0, 100, 100) drawLine(100, 100, 0, 100) drawLine(0, 100, 0, 0) ### to get a box drawn on the screen. And they can write procedures that generate general boxes, given the upper-left/bottom-right coordinates. What I have right now uses Tkinter and almost works --- I just need to finish some of the implementation details. From pdx4d@teleport.com Tue May 8 16:19:18 2001 From: pdx4d@teleport.com (Kirby Urner) Date: Tue, 8 May 2001 08:19:18 -0700 Subject: [Edu-sig] Intro and question: assignments/projects for year end In-Reply-To: <101930C39A6@kserver.org> Message-ID: <000301c0d7d2$40d3cbe0$0802a8c0@KirbyUrner> > C. RESOURCES > Among the wonderful modules you should definitely stop at > Kirby's pages. > These are mostly linked from: http://www.inetarena.com/~pdx4d/ocn/cp4e.html I've gotten a lot of mileage out of the Python + Povray synergy, the latter being a powerful, no cost ray-tracer. Povray runs off ascii text files (.pov) which you can have Python write. I mostly can (or bottle) polyhedra in Python, using a primitive vector class. Here are some of my fancier graphics, developed with Python's assistance: http://www.inetarena.com/~pdx4d/ocn/concavedodeca.html Crytography is another topic I take up. I've got both letter substitution cipher modeled on Enigma (sort of), and an intro to RSA (patent expired on that algorithm, kids can use freely). All this stuff is non-GUI (I use Python's IDLE for development, itself a GUI). There may be nothing suitable as is, but there might be something that sparks an imagination or two, plus example source code. Kirby From delza@alliances.org Tue May 8 18:39:20 2001 From: delza@alliances.org (Dethe Elza) Date: Tue, 08 May 2001 10:39:20 -0700 Subject: [Edu-sig] Turtle Draw program Message-ID: Hi folks, This is just an announcement for my own bit of "throwaway" code: a primitive turtle-drawing program called Kutia. I wanted a logo-like environment for introducing my daughter Mina (age 4) to programming. The idea was that you could move the turtle with buttons, or click the field to have it chase the mouse-clicks, or enter text commands. Each control method should be interlinked, so when the turtle chases the mouse, the commands it uses are entered in the command window, which would be editable. I have not implemented the command window yet, and the buttons don't seem very useful when you have direct manipulation of the turtle. In fact I think I can get rid of the penup/pendown buttons once I allow the turtle to be dragged directly. Anyway, it's pretty fun and ready for some comments. http://delza.alliances.org/archive/ Two classes in one file, notes and demo data at the top. It's more complicated right now than it needs to be, I'm still cleaning up the code which is there while I add additional functionality. There are a lot of methods which don't get used: I tried animating the rotation of the turtle but it was too slow, there is support for buttons to move forward, turn right/left, but I've removed the buttons based on usability testing. This is different from "adaptable interfaces" because the interface is not designed to change: direct manipulation is always available, as is the command window (when implemented). This allows the learner to switch back and forth at will between the two methods for ease of exploration. Also, when I say Logo-like, I'm using the term pretty loosly. I've never really used Logo, just read about it. Caveat emptor or something. And despite my .sig, this isn't a BT product, just a personal project. --Dethe Dethe Elza Chief Mad Scientist Burning Tiger Technologies From dscherer@vysics.com Tue May 8 21:02:22 2001 From: dscherer@vysics.com (David Scherer) Date: Tue, 8 May 2001 16:02:22 -0400 (EDT) Subject: [Edu-sig] Intro and question: assignments/projects for year end In-Reply-To: <101930C39A6@kserver.org> Message-ID: On Mon, 7 May 2001, Sheila King wrote: > I must've given a pretty convincing speech about Python, because 10 of my 17 > students picked to do Python. I was surprised. I thought most of them would want > to do a graphics project. Why not do both? For example, look at VPython: http://cil.andrew.cmu.edu/projects/visual This is used, among other places, in a freshman physics class (Matter & Interactions). Some of the students have no programming experience at all, but all are writing 3D physical simulations after two 1 hour lab sessions. I think APCS students should be able to do a few interesting things with it in 2 weeks. Of course, the other suggestions people have made sound very interesting also. Dave From lha2@columbia.edu Tue May 8 23:13:19 2001 From: lha2@columbia.edu (Lloyd Hugh Allen) Date: Tue, 08 May 2001 18:13:19 -0400 Subject: [Edu-sig] Algebra + Python Message-ID: <3AF86F7F.D0559860@mail.verizon.net> In response to the message """ Message: 1 From: "Daniel Ajoy" To: edu-sig@python.org Date: Mon, 7 May 2001 18:14:44 -0500 Subject: RE: [Edu-sig] Algebra + Python On 7 May 01, at 12:01, edu-sig-request@python.org wrote: > A simple way to compute the determinant is to add the signed > products of all permutations of matrix elements, choosing one > from each row (a total of row! possibilities). ciphers.py is > in charge of returning a list of all those possibilities Does that work for matrices 4x4 ? I ask because it didn't work for me. """ [very long. sorry. this is why we iterate when we program, so that the computer can do the boring stuff for us.] There are few "tricks" for finding determinants > 3x3. You have to go back to the why of how the tricks work. Let's start with a 1x1: [a] The determinant of that matrix is . It retains whatever sign the element had had. ===== Easy enough. Go on to a 2x2: a b c d which can be represented as [ [ a , b] [ c , d ] ], if you're a programmer type person and prefer your data one-dimensional. Start in the top row. Put your finger on "a", and block out the row (that is, the element "b") and the column (that is, the element "c"). You are left with the trivial submatrix [d], which has determinant of . This gives us the first part of the determinant, which is a*d (the thing that we had our finger on, times the determinant of the corresponding submatrix). Now put your finger on the next element in the top row, b. Ignore everything else in its row and in its column. You are left with the trivial submatrix [c], which has determinant of [c]. This gives us the second part of the determinant, b*c. Go back through your list of parts of the determinant, and alternate the signs on them. In this case, we have a*d - b*c. ===== Next, for a 3x3: a b c d e f g h i Start in the top row. Put your finger on "a", and block out the row and the column of "a". You are left with submatrix [ [ e , f] [ h , i ] ]. The first part of the determinant will be * det ( [ [ e , f ] [ h , i ] ] ), which is a ( ei - hf ) #taking the 2x2 determinant of the submatrix; the sign of a is #unchanged because a is in column 0. aei - ahf #using the distributive property Now go to "b". Blocking out the row and column of "b" leaves the submatrix [ [ d , f ] [ g , i ] ]. Because this is the second element we have played with, we need to change the sign of b, and then we will multiply that by the determinant of the submatrix. -b ( di - gf ) #the sign of b is opposite because b is in column 1 -bdi + bgf #using the distributive property Similarly, we get the elements c * det [[d,e][g,h]] c ( dh - eg ) cdh - ceg When you string those together, you get the familiar "diagonal" cheating method of finding the det of a 3x3. The procedure above, though, generalizes to n x n. Sorry to be verbose. Determinants are cool because the determinant of a 2x2 gives the area of a parallelogram with one vertex at the origin and two points identified by the rows or columns; or of a 3x3, the volume of a solid with parallel faces with vertices identified similarly; or of a 4x4, the hypervolume... and because if the determinant is zero, you know better than to look for an inverse (which might otherwise be time-consuming). (not that finding the determinant of a large matrix is terribly fast). Now to turn all of that into code. Now I know how I'm teaching recursion this summer. From e9625455@student.tuwien.ac.at Wed May 9 02:16:00 2001 From: e9625455@student.tuwien.ac.at (Christian Jeitler) Date: Wed, 09 May 2001 03:16:00 +0200 Subject: [Edu-sig] shortest path algorithm based on guido's essay and a post by June Kim Message-ID: <5.0.2.1.0.20010509015524.020fa4c0@stud3.tuwien.ac.at> hello! this code shows how to calculate the shortest path between two cities on a map based on: http://www.python.org/doc/essays/graphs.html i have changed the code with the hlp of a news article by June Kim. For small graphs it works better than the Dijkstra algorithm. If anybody has an idea how to speed up this algorithm ? By the way I am looking forward to the second part of the essay. def weight(path): weight_of_path= 0 for node in path: weight_of_path = weight_of_path + node[1] return weight_of_path def find_shortest_path(graph, start, end, path=[]): path = path + [start] path_hlp=[] for node_hlp in path: path_hlp = path_hlp + [node_hlp[0]] if start[0] == end: return path shortest_path = None for node in graph[start[0]]: if node[0] not in path_hlp: new_path = find_shortest_path(graph, node, end, path) if new_path: if not shortest_path or weight(new_path) < weight(shortest_path): shortest_path = new_path return shortest_path # real geographic area in vienna graph = {'A':[('B',513)], 'B':[('A',513),('C',1513),('J',1684),('K',1107)], 'C':[('B',1513),('D',406),('K',654)], 'D':[('C',406),('E',834),('L',860)], 'E':[('D',834),('L',889),('F',2472)], 'F':[('E',2472),('Z',170),('M',765),('G',2796)], 'G':[('F',2796),('N',1317),('H',737)], 'H':[('G',737),('P',1181),('I',1072)], 'I':[('H',1072),('Q',1020),('J',467)], 'J':[('I',467),('Q',565),('B',1684)], 'K':[('B',1107),('C',654),('P',1340),('Q',719)], 'Q':[('K',719),('I',1020),('J',565)], 'L':[('D',860),('E',889),('M',729),('O',648)], 'O':[('L',648),('N',709),('P',153)], 'M':[('L',729),('F',765),('N',444)], 'N':[('M',444),('G',1317),('O',709)], 'P':[('O',153),('H',1181),('K',1340)], 'Z':[('F',170)]} pathfinder = find_shortest_path(graph,('A',0),'Z') From pdx4d@teleport.com Wed May 9 06:51:31 2001 From: pdx4d@teleport.com (Kirby Urner) Date: Tue, 8 May 2001 22:51:31 -0700 Subject: [Edu-sig] Algebra + Python In-Reply-To: <3AF86F7F.D0559860@mail.verizon.net> Message-ID: <000701c0d84c$1990ad80$0802a8c0@KirbyUrner> > Now to turn all of that into code. Now I know how I'm > teaching recursion > this summer. However, if you want to be brute force about it, and non-recursive, you just need the n! permutations of column elements, picking one element from each column as you go down the rows. Each selection nets you a product, and you still need to compute its sign (talked about that just a post or two back). I was relieved to find this, as I was looking at the selective (row,column) blocking with recursion, and not liking the looks of that challenge. The code is rather simple this other way: def det(self): """ Return the determinant of a square matrix """ perms = permutations(self.n) prods = [] for perm in perms: prod = reduce(mul,[self.row(i)[int(perm[i])] for i in range(len(perm))]) prods.append(sign(perm)*prod) det = reduce(add,prods) return det Notes: self.n is just the dimension of the matrix (it's square, so n is all you need). permutations(self.n) returns the n! combinations, as we were discussing earlier, and you'll see sign(perm) as we were discussing earlier also. That's it: add the signed products (all n! of 'em) and you're done. My source is 'Beginning Linear Algebra' by Seymour Lipschutz, a Schaum's Outline Series (McGraw-Hill, 1997), Chapter 10, page 359. This isn't a computer programming book or anything, just a study aid I found in the math section of the local library. How do I get the permutations? Well, I'm sure there's lots of ways, but I just set up a base-4 number (for a 4x4 matrix) and count from 0000, 0001, 0002 -- except I eliminate any string with repeating digits, so 0123 is the first admitted. Add 1 to that, base 4, and you get 0130, which isn't "legal" either, but you get the idea (add up through 3210, crossing out any with repeating digits, and you've got your 4!=24 legal permutations). I could refine this some (i.e. start with 0123..(n-1) -- but it works well enough for my purposes as is, so further optimizing is back burner for now. How do I set up a base-4 number? Well, I already had these digit objects defined to add modulo n, and a Number object where you line up the digits objects with the bases you want (i.e. you can do mixed base numbers if you like). That was all in ciphers.py already. So I took advantage. But I bet someone here could whip out a permutations generator that didn't rely on all this claptrap, would be efficient and short. I just happened to have these tools handy, so I didn't spend a lot of time looking for another solution. Kirby From dyoo@hkn.eecs.berkeley.edu Wed May 9 11:16:29 2001 From: dyoo@hkn.eecs.berkeley.edu (Daniel Yoo) Date: Wed, 9 May 2001 03:16:29 -0700 (PDT) Subject: [Edu-sig] graphics programming with Python Message-ID: This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. Send mail to mime@docserver.cac.washington.edu for more info. --545289610-1210645831-989403251=:13714 Content-Type: TEXT/PLAIN; charset=US-ASCII Here's a preliminary version of a simplified interface to a Tkinter canvas. It's simple enough so that the user just needs to type: ### from graphics import * def drawBox(x1, y1, x2, y2): """Draws a box where the upper left is (x1, y1), and the lower right is (x2, y2).""" positionPen(x1, y1) drawLineTo(x2, y1) drawLineTo(x2, y2) drawLineTo(x1, y2) drawLineTo(x1, y1) drawBox(-100, 100, 100, -100) ### to get a box drawn. By default, the Canvas is 400x400, and the user can send commands like: drawLine drawPoint setRGBColor without having to worry about creating a canvas. Also, it uses normal rectangular coordinates, so (0, 0) is at the center, (200, 200) is the upper right corner, and (-200, -200) is the bottom left. Please give suggestions on this; I just typed this up yesterday, so it surely has room for improvement and clarity. I hope this is useful! --545289610-1210645831-989403251=:13714 Content-Type: TEXT/PLAIN; charset=US-ASCII; name="graphics.py" Content-Transfer-Encoding: BASE64 Content-ID: Content-Description: Content-Disposition: attachment; filename="graphics.py" IiIiVGhpcyBpcyBhIHNtYWxsIGdyYXBoaWNzIG1vZHVsZSB0aGF0IG1pbWlj cyBzb21lIHRoZSBmdW5jdGlvbmFsaXR5DQpvZiB3aGF0IHRoZSBDUzMgc3R1 ZGVudHMgdXNlIHRvIGRvIGZyYWN0YWwgZ3JhcGhpY3MuICBJdCdzIHNpbXBs aWZpZWQNCmJlY2F1c2UgdGhlIGNvb3JkaW5hdGVzIGFyZSBjZW50ZXJlZCBh dCAoMCwgMCkgaW4gdGhlIG1pZGRsZSBvZiB0aGUNCnNjcmVlbiBhbmQgaXQg dXNlcyBmYW1pbGlhciBjb29yZGluYXRlIG9yaWVudGF0aW9uLiIiIg0KDQoj IEknbSB0cnlpbmcgdG8gbWFrZSB0aGlzIGltcG9ydCBzYWZlLg0KDQppbXBv cnQgVGtpbnRlcg0KDQpjbGFzcyBHcmFwaGljczoNCiAgICBkZWYgX19pbml0 X18oc2VsZiwgcm9vdCk6DQogICAgICAgIHNlbGYuX3Jvb3QgPSByb290DQog ICAgICAgIHNlbGYuX3hwb3MsIHNlbGYuX3lwb3MgPSAwLCAwDQogICAgICAg IHNlbGYuX3dpZHRoID0gNDAwDQogICAgICAgIHNlbGYuX2hlaWdodCA9IDQw MA0KICAgICAgICBzZWxmLl9yZ2IgPSAnIzAwMDAwMCcgICMgRGVmYXVsdCBz aG91bGQgYmUgYmxhY2sNCiAgICAgICAgc2VsZi5fY2FudmFzID0gVGtpbnRl ci5DYW52YXMoc2VsZi5fcm9vdCwgd2lkdGg9c2VsZi5fd2lkdGgsDQogICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhlaWdodD1zZWxm Ll9oZWlnaHQsIGJnPSd3aGl0ZScpDQogICAgICAgIHNlbGYuX2NhbnZhcy5w YWNrKCkNCiAgICAgICAgc2VsZi5jbGVhckdyYXBoaWNzKCkNCg0KICAgIGRl ZiBjbGVhckdyYXBoaWNzKHNlbGYpOg0KICAgICAgICAiIiIiQ2xlYXIgdGhl IHNjcmVlbiBvZiBhbGwgZHJhd2luZ3MuIiIiDQogICAgICAgIGZvciBpZCBp biBzZWxmLl9jYW52YXMuZmluZF9hbGwoKToNCiAgICAgICAgICAgIHNlbGYu X2NhbnZhcy5kZWxldGUoaWQpDQoNCiAgICBkZWYgcG9zaXRpb25QZW4oc2Vs ZiwgeCwgeSk6DQogICAgICAgICIiIk1vdmUgdGhlIHBlbiB0byB0aGUgc3Bl Y2lmaWMgcG9zaXRpb24uIiIiDQogICAgICAgIHNlbGYuX3hwb3MsIHNlbGYu X3lwb3MgPSB4LCB5DQoNCiAgICBkZWYgZHJhd0xpbmVUbyhzZWxmLCB4LCB5 KToNCiAgICAgICAgIiIiRHJhdyB0aGUgbGluZSBmcm9tIHRoZSBjdXJyZW50 IHBvc2l0aW9uIHRvICh4LCB5KS4NCiAgICAgICAgQXMgYSBzaWRlIGVmZmVj dCwgdGhlIGN1cnJlbnQgcG9zaXRpb24gYmVjb21lcyAoeCwgeSkuIiIiDQog ICAgICAgIHgxLCB5MSA9IHNlbGYuY29udmVydENvb3JkKHNlbGYuX3hwb3Ms IHNlbGYuX3lwb3MpDQogICAgICAgIHgyLCB5MiA9IHNlbGYuY29udmVydENv b3JkKHgsIHkpDQogICAgICAgIHNlbGYuX2NhbnZhcy5jcmVhdGVfbGluZSh4 MSwgeTEsIHgyLCB5MiwgZmlsbD1zZWxmLl9yZ2IpDQogICAgICAgIHNlbGYu cG9zaXRpb25QZW4oeCwgeSkNCg0KICAgIGRlZiBkcmF3TGluZShzZWxmLCB4 MSwgeTEsIHgyLCB5Mik6DQogICAgICAgICIiIkRyYXcgYSBsaW5lIGZyb20g KHgxLCB5MSkgdG8gKHgyLCB5MikuICBBcyBhIHNpZGUgZWZmZWN0LA0KICAg ICAgICB0aGUgY3VycmVudCBwb3NpdGlvbiBiZWNvbWVzICh4MiwgeTIpLiIi Ig0KICAgICAgICBzZWxmLnBvc2l0aW9uUGVuKHgxLCB5MSkNCiAgICAgICAg c2VsZi5kcmF3TGluZVRvKHgyLCB5MikNCg0KICAgIGRlZiBkcmF3UG9pbnQo c2VsZiwgeCwgeSk6DQogICAgICAgICIiIkRyYXcgYSBzaW5nbGUgcG9pbnQg YXQgKHgsIHkpLiAgQXMgYSBzaWRlIGVmZmVjdCwNCiAgICAgICAgdGhlIGN1 cnJlbnQgcG9zaXRpb24gYmVjb21lcyAoeCwgeSkuIiIiDQogICAgICAgIHNl bGYucG9zaXRpb25QZW4oeDEsIHkxKQ0KICAgICAgICB4MSwgeTEgPSBzZWxm LmNvbnZlcnRDb29yZCh4LCB5KQ0KICAgICAgICBzZWxmLl9jYW52YXMuY3Jl YXRlX292YWwoeDEsIHkxLCB4MSwgeTEsIG91dGxpbmU9c2VsZi5fcmdiKQ0K DQogICAgZGVmIGNsZWFyUG9pbnQoc2VsZiwgeCwgeSk6DQogICAgICAgICIi IkNsZWFycyBhIHNpbmdsZSBwb2ludCBhdCAoeCwgeSkuICBBcyBhIHNpZGUg ZWZmZWN0LA0KICAgICAgICB0aGUgY3VycmVudCBwb3NpdGlvbiBiZWNvbWVz ICh4LCB5KS4iIiINCiAgICAgICAgc2VsZi5wb3NpdGlvblBlbih4MSwgeTEp DQogICAgICAgIGJnY29sb3IgPSBzZWxmLl9jYW52YXMuY2dldCgnYmcnKQ0K ICAgICAgICB4MSwgeTEgPSBzZWxmLmNvbnZlcnRDb29yZCh4LCB5KQ0KICAg ICAgICBzZWxmLl9jYW52YXMuY3JlYXRlX292YWwoeDEsIHkxLCB4MSwgeTEs IG91dGxpbmU9Ymdjb2xvcikNCiAgICANCiAgICBkZWYgZ3JhcGhpY3NUZXh0 KHNlbGYsIG1zZywgeCwgeSk6DQogICAgICAgICIiIldyaXRlcyBhIGxpbmUg b2YgdGV4dCwgbGVmdCBqdXN0aWZlZCBmcm9tICh4LCB5KS4iIiINCiAgICAg ICAgeDEsIHkxID0gc2VsZi5jb252ZXJ0Q29vcmQoeCwgeSkNCiAgICAgICAg c2VsZi5fY2FudmFzLmNyZWF0ZV90ZXh0KHgxLCB5MSwgdGV4dD1tc2csIGZp bGw9c2VsZi5fcmdiKQ0KICAgIA0KICAgIGRlZiBzZXRSR0JDb2xvcihzZWxm LCByLCBnLCBiKToNCiAgICAgICAgIiIiQ2hhbmdlcyB0aGUgY3VycmVudCBj b2xvciB0byAociwgZywgYiksIHdoZXJlDQogICAgICAgIGVhY2ggY29tcG9u ZW50IGlzIGEgdmFsdWUgYmV0d2VlbiAwIGFuZCAyNTUuIiIiDQogICAgICAg IHNlbGYuX3JnYiA9ICcjJTAyWCUwMlglMDJYJyAlIChyLCBnLCBiKQ0KDQog ICAgZGVmIGNvbnZlcnRDb29yZChzZWxmLCB4LCB5KToNCiAgICAgICAgbmV3 eCA9IHNlbGYuX3dpZHRoLzIgKyB4DQogICAgICAgIG5ld3kgPSBzZWxmLl9o ZWlnaHQvMiAtIHkNCiAgICAgICAgcmV0dXJuIG5ld3gsIG5ld3kNCg0KDQoN Cg0KIyMjIEhlcmUgYXJlIHNvbWUgZ2xvYmFsIGZ1bmN0aW9ucyBhbmQgdmFy aWFibGVzIHRvIG1ha2UgdGhpbmdzIGVhc2llcg0KIyMjIGZvciBhIGJlZ2lu bmVyIHVuYWNjdXN0b21lZCB0byBPT1AuICBOb3RlOiB0aGlzIGlzIHVnbHkg YmVjYXVzZSB3ZQ0KIyMjIG5lZWQgYW4gZXh0cmEgbGV2ZWwgb2YgaW5kaXJl Y3Rpb24gaGVyZTogd2Ugd2FudCB0byBtYWtlICJmcm9tDQojIyMgZ3JhcGhp Y3MgaW1wb3J0ICoiIHdvcmssIGJ1dCB0aGlzIHRha2VzIHNvbWUgc2lsbGlu ZXNzIHRvIGdldCBpdA0KIyMjIHdvcmtpbmcgd2VsbC4gIE1pc2VyeSBvZiB0 aGUgZmV3IGZvciB0aGUgam95IG9mIHRoZSBtYW55LiAgKmdyaW4qDQoNCiMj IE91ciBjYW52YXMgb2JqZWN0DQpfX2NhbnZhcyA9IE5vbmUNCg0KIyMgVGhl cmUgbXVzdCBiZSBhIGJldHRlciB3YXkgdG8gd3JpdGUgdGhpcy4NCmRlZiBw b3NpdGlvblBlbigqYXJncyk6DQogICAgdHJ5OiBhcHBseShfX3Bvc2l0aW9u UGVuLCBhcmdzKQ0KICAgIGV4Y2VwdCBUa2ludGVyLlRjbEVycm9yOg0KICAg ICAgICBjbGVhckdyYXBoaWNzKCkNCiAgICAgICAgYXBwbHkoX19wb3NpdGlv blBlbiwgYXJncykNCiAgICAgICAgIA0KZGVmIGRyYXdMaW5lVG8oKmFyZ3Mp Og0KICAgIHRyeTogYXBwbHkoX19kcmF3TGluZVRvLCBhcmdzKQ0KICAgIGV4 Y2VwdCBUa2ludGVyLlRjbEVycm9yOg0KICAgICAgICBjbGVhckdyYXBoaWNz KCkNCiAgICAgICAgYXBwbHkoX19kcmF3TGluZVRvLCBhcmdzKQ0KICAgICAg ICANCmRlZiBkcmF3TGluZSgqYXJncyk6DQogICAgdHJ5OiBhcHBseShfX2Ry YXdMaW5lLCBhcmdzKQ0KICAgIGV4Y2VwdCBUa2ludGVyLlRjbEVycm9yOg0K ICAgICAgICBjbGVhckdyYXBoaWNzKCkNCiAgICAgICAgYXBwbHkoX19kcmF3 TGluZSwgYXJncykNCg0KZGVmIGRyYXdQb2ludCgqYXJncyk6DQogICAgdHJ5 OiBhcHBseShfX2RyYXdQb2ludCwgYXJncykNCiAgICBleGNlcHQgVGtpbnRl ci5UY2xFcnJvcjoNCiAgICAgICAgY2xlYXJHcmFwaGljcygpDQogICAgICAg IGFwcGx5KF9fZHJhd1BvaW50LCBhcmdzKQ0KDQpkZWYgY2xlYXJQb2ludCgq YXJncyk6DQogICAgdHJ5OiBhcHBseShfX2NsZWFyUG9pbnQsIGFyZ3MpDQog ICAgZXhjZXB0IFRraW50ZXIuVGNsRXJyb3I6DQogICAgICAgIGNsZWFyR3Jh cGhpY3MoKQ0KICAgICAgICBhcHBseShfX2NsZWFyUG9pbnQsIGFyZ3MpDQoN CmRlZiBncmFwaGljc1RleHQoKmFyZ3MpOg0KICAgIHRyeTogYXBwbHkoX19n cmFwaGljc1RleHQsIGFyZ3MpDQogICAgZXhjZXB0IFRraW50ZXIuVGNsRXJy b3I6DQogICAgICAgIGNsZWFyR3JhcGhpY3MoKQ0KICAgICAgICBhcHBseShf X2dyYXBoaWNzVGV4dCwgYXJncykNCg0KZGVmIHNldFJHQkNvbG9yKCphcmdz KToNCiAgICB0cnk6IGFwcGx5KF9fc2V0UkdCQ29sb3IsIGFyZ3MpDQogICAg ZXhjZXB0IFRraW50ZXIuVGNsRXJyb3I6DQogICAgICAgIGNsZWFyR3JhcGhp Y3MoKQ0KICAgICAgICBhcHBseShfX3NldFJHQkNvbG9yLCBhcmdzKQ0KDQpf X3Bvc2l0aW9uUGVuID0gTm9uZQ0KX19kcmF3TGluZVRvID0gTm9uZQ0KX19k cmF3TGluZSA9IE5vbmUNCl9fZHJhd1BvaW50ID0gTm9uZQ0KX19jbGVhclBv aW50ID0gTm9uZQ0KX19ncmFwaGljc1RleHQgPSBOb25lDQpfX3NldFJHQkNv bG9yID0gTm9uZQ0KDQoNCmRlZiBjbGVhckdyYXBoaWNzKCk6DQogICAgX19y ZXNldEdyYXBoaWNzKCkNCiAgICBfX3Jlc2V0RnVuY3Rpb25zKCkNCiAgICBf X2NhbnZhcy5jbGVhckdyYXBoaWNzKCkNCg0KDQpkZWYgX19yZXNldEdyYXBo aWNzKCk6DQogICAgZ2xvYmFsIF9fY2FudmFzDQogICAgaWYgVGtpbnRlci5f ZGVmYXVsdF9yb290ID09IE5vbmU6DQogICAgICAgIFRraW50ZXIuX2RlZmF1 bHRfcm9vdCA9IFRraW50ZXIuVGsoKQ0KICAgICAgICBfX2NhbnZhcyA9IE5v bmUNCiAgICBpZiBfX2NhbnZhcyA9PSBOb25lOg0KICAgICAgICBfX2NhbnZh cyA9IEdyYXBoaWNzKFRraW50ZXIuX2RlZmF1bHRfcm9vdCkNCg0KDQpkZWYg X19yZXNldEZ1bmN0aW9ucygpOg0KICAgIGdsb2JhbCBfX2NhbnZhcw0KICAg IGdsb2JhbCBfX3Bvc2l0aW9uUGVuLCBfX2RyYXdMaW5lVG8sIF9fZHJhd0xp bmUNCiAgICBnbG9iYWwgX19kcmF3UG9pbnQsIF9fY2xlYXJQb2ludCwgX19n cmFwaGljc1RleHQsIF9fc2V0UkdCQ29sb3INCiAgICBfX3Bvc2l0aW9uUGVu ID0gX19jYW52YXMucG9zaXRpb25QZW4NCiAgICBfX2RyYXdMaW5lVG8gPSBf X2NhbnZhcy5kcmF3TGluZVRvDQogICAgX19kcmF3TGluZSA9IF9fY2FudmFz LmRyYXdMaW5lDQogICAgX19kcmF3UG9pbnQgPSBfX2NhbnZhcy5kcmF3UG9p bnQNCiAgICBfX2NsZWFyUG9pbnQgPSBfX2NhbnZhcy5jbGVhclBvaW50DQog ICAgX19ncmFwaGljc1RleHQgPSBfX2NhbnZhcy5ncmFwaGljc1RleHQNCiAg ICBfX3NldFJHQkNvbG9yID0gX19jYW52YXMuc2V0UkdCQ29sb3INCg0KIyMg TGV0J3Mgc3RhcnQgdGhlIG1hZ2ljLg0KY2xlYXJHcmFwaGljcygpDQoNCg== --545289610-1210645831-989403251=:13714-- From jasonic@nomadicsltd.com Wed May 9 19:09:49 2001 From: jasonic@nomadicsltd.com (Jason Cunliffe) Date: Wed, 9 May 2001 14:09:49 -0400 Subject: [Edu-sig] About myself References: Message-ID: <011401c0d8b3$3d813f40$c3090740@megapathdsl.net> From: "Roman Suzi" > Well. I was asked to introduce myself and here is my informal > self-introduction in the aspect of this SIG. As I hope > to stay (at least lurk) here for long. Hi Roman Thanks for the intro.. I hope you stick around. You seem to be grappling with familiar problems. > However, I was always interested in the teaching programming and it always > intrigues me how one become a programmer. Yesterday you can't program, and > today you feel, that you can! I feel that several times every day! Seriously. > But one thing I am very strong about: if we need to teach somebody > programming, the Python is the choice No. 1. (Well, probably it depends on > the age. For little-ones Logo is probably the choice or some special > adopted environment). But for those who want to learn programming Python > is very-very useful. We all agree Python is great andlove it. But I question anyone who implies xyz god/tool/method is the #1. Everything and everybody has a context, needs, a past, a present and future. This raises some interesing isseus about 'suitability' of programming languages for kids [we are all kids] and how to get them going... CASE STUDY: 12-year old want to learn 'programming' WHY: - He's curious - Wants to impress his friends - it's the new rock'n'roll - Dreams of controlling everything in his home with wireless magic embdeded cyberware - Likes Flash animations/games and computer games and would like to 'program' some of his own - He's surrounded by a culture of MegaBudget 'computer' graphics Hollywood movies, and dreams of making a succesful career as independent computer whiz, and at the same time showing anyone [teachers especially] who ever doubted him: "See how smart I really was/am/will_be ?!" My nephew is 12 and really keen to get started on programming. His parents and school know next to nothign about any of this. So he's own except for the beautiful deep ocean of the Internet. I wanted to say PythonPythonPython to him, but he already had eyes for REALBasic [he hs an iMac since 1 year]. Last summer he asked me what I thought he should learn and what I thought about REALBasic. I said something to the effect of: "Languages and technologies come and go. 50% of why you select XYZ should be based on the vitality and quality if its community. Pay attention to the age of something. If it is dying..probably best not to invest much effort unless you are very confident. If it is too young, this is exciting but 'bleeding edge' is also very time consuming and can be frustrating to get things done. For beginners, best to find something which has been around for some time, is well supported and still very much growing. Like a healthy mature fruit tree..etc" Then we went on the web together and browsed around the REALBasic sites, looking at list archives, contributions, reviews etc. I showed them that the first thing you have want to know whenever you read a nice review is the truth behind it. So we looked at the mailing list. We scanned the subject headers tree to get a feel for what kind of dialogue, what depth of detail and support, what kind of problems people were having, and if they were gettign satisfactory answers. Look at some contributions. Anywy , after looking at REALBasic for a while, I came away pretty impressed. I said: "Yes this is not a bad place to start. Looks like fun. What you will learn here will be helpful. Later you will probably want to explore other types of programming and langauges. The most importnat thing is how to describe what you want, naming things, how to analyze problems, and match that with whatever tools you have. Know your tools and how to pick them and combine them well." The langauge environemnts I recommended were ActionScript in Flash5 [he's keen on Flash] , Lego Mindstorms [he's loves the idea of robotics], and of course Python. An important issues here is also that REALBasic is something he found out about for himself, and wants to try. This proabably comes from reading some enthusiatic reviews in a Macintosh Magazine. I showed him Jasonic Trick #T for quickly assessing any technology: http://www.google.com search for trouble for example: trouble RealBasic or trouble Python or trouble outlook Try again with similar keys like "troubleshooting", 'Help!" I suggested wait a year till ActionScript has stabilized and the books and How-Tos are avaiable. [Summer 2001 this is now true. The new OReilly book *just* published. See some samples quotes at end of this email. I think Colin Moock writes a great introduction to programming. What do you think ..?] Lego Mindstorms is very cool but probably best tackled after getting comfortable with other prgoramming liek REALBasic or Python. He asked me what's Python. So we looked at Python together - in Pythonwin, and browsed online etc. I could see he was not ready for it and I was afraid I was going to lose him fast... All that Unix culture oozing through the cracks, mysterious intros that mention environment variables withuot explaing what the fuck they are and how to set them, dubious Mac support [getting better again with MacOSX coudl be much more Python friendly] no simple one-click executables without diving through lots in clever READMEs. This kids wants to progam something and end up with soemthnig which will work. A single binary object he can put on his desktop, a disk or email to friend, show his doubting teachers. Python does not encourage this, though it is becoming more and more possible. If it were bundled and installed everywhere on all systems, life would be different [and better]. Yes it is usually easy to download and install when you know how, but CP4E needs to figure the distribution politics better. ============================================================================ > (It's hard to switch from it to other languages, though ;-) But in schools > we do not need to prepare programmers. It's all about development in the > minds... Yes > In today's school we are drifting more and more toward "user skills" > (worsprocessing and such mouse-moving behaviour). This is what bothers me > too, as I think those who is capable of programming need to have tools to > learn and get successful results. This raises their IQ ;-) and improves > understanding of life, whereever they will work. Yes. > Still I do not see what can be done to the situation except with promoting > Python to the advanced users and teachers. Unfortunately, I am no more in > position where I can influence this process here (I worked in the > teacher's retraining institute's IT center), so probably my presence > here will not be too visible (I do not have much time to do something > real, usually I just generate lots of ideas ;-) Well I believe Kirby's curriculum strategy is an essential step. http://www.inetarena.com/~pdx4d/ocn/ Even if everyone got hit by a very special RCrumb meatball today or next Tuesday, and said "OK! Wow - Let's start using nothing but Python for all our teaching from now on" Then they would have job #1 - figuring out how what and when and lack of curriculum. Countries who have embraced Linux as national OS policy and have ambitious plans active for computer education and network infsractucture are likely to be the move Python in the classrom from enlightened experiment to reality. South Korea for example. > (I am also a participant of Seul/EDU (Simple End User Linux, > educational aspect. Python Edu-SIG /\ Seul-EDU != []. > > And a moderator of relcom.education newsgroup. Don't follow that. Thanks I'll look > So, if there are some need to communicate some > ideas/offers/questions/queries with the later, you can ask me. I will try > to translate it into Russian and put it into there. Great. > In fact, in the near future I want to prepare an "advertizement" of Python > (and free software) for relcom.education. That is why I also want to > listen here. cheers ./Jason REFERENCE READING for REALBasic and Actionscript ============================================================================ http://www.realbasic.com/ REALbasic : The Definitive Guide by Matt Neuburg Paperback - 660 pages 1 Ed edition (October 1999) O'Reilly & Associates; ISBN: 1565926579 http://www.amazon.com/exec/obidos/ASIN/1565926579/ref%3Dpd%5Fsim%5Felt%5Fl1/ 107-4909741-5694943 ============================================================================ http://www.moock.org/asdg/ sample chapters: What do you think of this as style/content for beginners? Chapter 1 - A Gentle Introduction for Non-Programmers I'm going to teach you to talk to Flash. Not just to program Flash but to say things to it and to listen to what it has to say in return. This is not a metaphor or simply a rhetorical device. It's a philosophical approach to programming. Programming languages are used to send information to and receive information from computers. They are collections of vocabulary and grammar used to communicate, just like human languages. Using a programming language we tell a computer what to do or ask it for information. It listens, tries to perform the requested actions, and gives responses. So while you may think you are reading this book in order to "learn to program" you are actually learning to communicate with Flash. But of course, Flash doesn't speak English, French, German, or Cantonese. Flash's native language is ActionScript, and you're going to learn to speak it. Learning to speak a computer language is sometimes considered synonymous with learning to program. But there is more to programming than learning a language's syntax. What would it be like if Flash could speak English-if we didn't need to learn ActionScript in order to communicate with it? What would happen if we were to say, "Flash, make a ball bounce around the screen?" Flash couldn't fulfill our request because it doesn't know what a "ball" is. Okay, okay, that's just a matter of semantics. What Flash expects us to describe is the objects in the world it knows: movie clips, buttons, frames, etc. So, let's rephrase our request in terms Flash recognizes and see what happens: "Flash, make the movie clip named ball_one bounce around the screen." Flash still can't fulfill our request without more information. How big should the ball be? Where should it be placed? In which direction should it begin travelling? How fast should it go? Around which part of the screen should it bounce? For how long? In two dimensions or three? Hmm...we weren't expecting all these questions. In reality, Flash doesn't ask us these questions. Instead, when Flash can't understand us, it just doesn't do what we want it to, or it yields an error message. For now, we'll pretend Flash asked us for more explicit instructions, and reformulate our request as a series of steps. 1. A ball is a circular movie clip symbol named ball. 2. A square is a four-sided movie clip symbol named square. 3. Make a new green ball 50 pixels in diameter. 4. Call the new ball ball_one. 5. Make a new black square 300 pixels wide and place it in the middle of the Stage. 6. Place ball_one somewhere on top of the square. 7. Move ball_one in a random direction at 75 pixels per second. 8. If ball_one hits one of the sides of the square, make it bounce. 9. Do this until I tell you to stop. Even though we gave our instructions in English, we still had to work through all the logic that governs our bouncing ball in order for Flash to understand us. Obviously there's more to programming than merely the syntax of programming languages. Just as in English, knowing lots of words doesn't necessarily mean you're a great communicator. Our hypothetical English-speaking-Flash example exposes four important aspects of programming: · No matter what the language, the art of programming lies in the formulation of logical steps. · Before you try to say something in a computer language, it usually helps to say it in English. · A conversation in one language translated into a different language is still made up of the same basic statements. · Computers aren't very good at making assumptions. They also have a very limited vocabulary. Most programming has nothing to do with writing code. Before you write even a single line of ActionScript, think through exactly what you want to do and write out your system's functionality as a flowchart or a blueprint. Once your program has been described sufficiently at the conceptual level, you can translate it into ActionScript. In programming-as in love, politics, and business-effective communication is the key to success. For Flash to understand your ActionScript, you have to get your syntax absolutely correct down to the last quote, equal sign, and semicolon. And to assure that Flash knows what you're talking about, you must only refer to the world it knows in terms it recognizes. What may be obvious to you is not obvious to a computer. Think of programming a computer like talking to a child: take nothing for granted, be explicit in every detail, and list every step that's necessary to complete a task. But remember that unlike children, Flash will do precisely what you tell it to do and nothing that you don't tell it do. Some Basic Phrases On the first day of any language school you'd expect to learn a few basic phrases ("Good day," "How are you," etc). Even if you're just memorizing a phrase and don't know what each word means, you can learn the effect of the phrase and can repeat it to produce that effect. Then, once you've learned the rules of grammar, expanded your vocabulary, and used the words from your memorized phrases in multiple contexts, you can reassess your early phrases and understand them in a richer way. The rest of this chapter will be much like that first day of language school-you'll see bits and pieces of code, and you'll be introduced to some fundamental programming grammar. The rest of the book will build on that foundation. You may want to come back to this chapter when you've finished the book to see just how far you've traveled. ...fast forward to ... excerpt from chapter sample online at: The "Objectness" of Movie Clips As of Flash 5, movie clips can be manipulated like the objects we learned about in Chapter 12, Objects and Classes. We may retrieve and set the properties of a clip, and we may invoke built-in or custom methods on a clip. Unlike other objects, an operation performed on a clip may have a visible or audible result in the Player. Movie clips are not truly a type of object; there is no MovieClip class or constructor, nor can we use an object literal to instantiate a movie clip in our code. So what, then, are movie clips if not objects? They are members of their very own object-like datatype, called movieclip (we can prove it by executing typeof on a movie clip, which returns the string "movieclip"). The main difference between movie clips and true objects is how they are allocated (created) and deallocated (disposed of, or freed). For details, see Chapter 15, Advanced Topics. Despite this technicality, however, we nearly always treat movie clips exactly like objects. So how does the "objectness" of movie clips affect our use of them in ActionScript? Most notably, it dictates the way we control clips and examine their properties. Movie clips can be controlled directly through built-in methods. For example: eyes.play( ); We can retrieve and set a movie clip's properties using the dot operator, just as we would access the properties of any object: ball._xscale = 90; var radius = ball._width / 2; A variable in a movie clip is simply a property of that clip, and we can use the dot operator to set and retrieve variable values: myClip.myVariable = 14; x = myClip.myVariable; Submovie clips can be treated as object properties of their parent movie clips. We therefore use the dot operator to access "nested" clips: clipA.clipB.clipC.play( ); and we use the reserved _ parent property to refer to the clip containing the current clip: _ parent.clipC.play( ); Treating clips as objects affords us all the luxuries of convenient syntax and flexible playback control. But our use of clips as objects also lets us manage clips as data; we can store a movie clip in an array element or a variable and even pass a clip reference to a function as an argument! Here, for example, is a function that moves a clip to a particular location on the screen: function moveClip (clip, x, y) { clip._x = x; clip._y = y; } moveClip(ball, 14, 399); Throughout the rest of this chapter, we'll learn the specifics of referencing, controlling, and manipulating movie clips as data objects. ============================================================================ ___________________________________________________________ Jason CUNLIFFE = NOMADICS['Interactive Art and Technology'] From dajoy@softhome.net Wed May 9 20:44:01 2001 From: dajoy@softhome.net (Daniel Ajoy) Date: Wed, 9 May 2001 14:44:01 -0500 Subject: [Edu-sig] Re: Determinants and permutations In-Reply-To: Message-ID: On 9 May 01, at 12:01, edu-sig-request@python.org wrote: > > Now to turn all of that into code. Now I know how I'm > > teaching recursion > > this summer. > > However, if you want to be brute force about it, and non-recursive, > you just need the n! permutations of column elements, picking one > element from each column as you go down the rows. Each selection > nets you a product, and you still need to compute its sign (talked > about that just a post or two back). > > I was relieved to find this, as I was looking at the selective > (row,column) blocking with recursion, and not liking the looks of > that challenge. I did, sometime ago, programmed the recursive definition of determinant using adjoints and minors, I did it in Logo (MSWLogo to be precise), but it was terribly slow. That is really "brute force" approach. I thank Kirby for showing me the permutations approach. Now, that with his help I was able to figure out the pattern in the signs, my determinant implementation in Logo works wonderfully (I tested with a 6x6 matrix). > How do I get the permutations? Well, I'm sure there's lots > of ways, but I just set up a base-4 number (for a 4x4 matrix) > and count from 0000, 0001, 0002 -- except I eliminate any > string with repeating digits, so 0123 is the first admitted. > Add 1 to that, base 4, and you get 0130, which isn't "legal" > either, but you get the idea (add up through 3210, crossing > out any with repeating digits, and you've got your 4!=24 > legal permutations). I could refine this some (i.e. start > with 0123..(n-1) -- but it works well enough for my purposes > as is, so further optimizing is back burner for now. That is the advantage of an object oriented languaje: a lot of the code can be reused easily. I developed my permutations algorithm using the backtracking approach, and its more general. Since I had that algorithm ready, it was fairly easy to develop the determinant algorithm too. My permutations algorithm is called permconj since "conjunto" is "set" in spanish. show permconj [1 [a b c]] [[a] [b] [c]] show permconj [2 [a b c]] [[a b] [a c] [b c] [b a] [c a] [c b]] show permconj [3 [a b c]] [[a b c] [a c b] [b c a] [b a c] [c a b] [c b a]] show permconj [0 [a b c]] [[]] show count [a b c] 3 show count permconj [6 [a b c d e f]] 720 I also have "permu" that returns only the counts. es permu [3 1] 3 es permu [3 0] 1 es permu [3 2] 6 es permu [3 3] 6 Anyway, one of these days I'm going to tray to do Kirbys polyhedra in MSWLogo too, since MSWLogo has 3D graphic rendition incorporated. Daniel From dyoo@hkn.eecs.berkeley.edu Thu May 10 01:55:09 2001 From: dyoo@hkn.eecs.berkeley.edu (Daniel Yoo) Date: Wed, 9 May 2001 17:55:09 -0700 (PDT) Subject: [Edu-sig] graphics.py: simplified graphics for beginners Message-ID: This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. Send mail to mime@docserver.cac.washington.edu for more info. --545289610-2072271115-989456109=:29220 Content-Type: TEXT/PLAIN; charset=US-ASCII Hiya everyone, Here's an updated copy of the small graphics module I cooked up, with a small circle-drawing demonstration that uses it. What do people think? Would this module make graphics programming more accessible to beginning students? --545289610-2072271115-989456109=:29220 Content-Type: TEXT/PLAIN; charset=US-ASCII; name="circle.py" Content-Transfer-Encoding: BASE64 Content-ID: Content-Description: Content-Disposition: attachment; filename="circle.py" IyMgVGhpcyBwaWVjZSBvZiBjb2RlIGdpdmVzIHVzIG9uZSB3YXkgdG8gZHJh dyBhIGNpcmNsZSBpbiBQeXRob24uDQojIyBJdCdzIG5vdCBwYXJ0aWN1bGFy bHkgZWZmaWNpZW50LCBidXQgaXQncyBjdXRlLg0KIyMNCiMjIGR5b29AaGtu LmVlY3MuYmVya2VsZXkuZWR1DQojIw0KIyMgTGV0J3Mgc2F5IHRoYXQgd2Ug d3JpdGUgYSBwcm9ncmFtIHRvIGRyYXcgcmVndWxhciBwb2x5Z29ucyBvZiBu DQojIyBwb2ludHMuICBGb3IgZXhhbXBsZSwgZm9yIG49Mywgd2UgZ2V0IGEg dHJpYW5nbGUuICBGb3Igbj00LCB3ZSBoYXZlDQojIyBhIHNxdWFyZSwgYW5k IHNvIG9uLiAgV2hhdCBoYXBwZW5zIHdoZW4gbiBnZXRzIGxhcmdlciBhbmQg bGFyZ2VyPw0KIyMNCiMjIE9uZSBpZGVhIGZvciBkcmF3aW5nIGEgY2lyY2xl IGlzIHRvIGRyYXcgb3VyIHBvbHlnb24gd2l0aCBsYXJnZXINCiMjIGFuZCBs YXJnZXIgbiwgdW50aWwgd2UgZ2V0IHNvbWV0aGluZyBzYXRpc2ZhY3Rvcnku ICBUaGlzIHByb2dyYW0NCiMjIHNob3dzIGEgdmlzdWFsIGRlc2NyaXB0aW9u cyBvZiB0aGlzIHByb2Nlc3MuICBUaGUgbWFpbiBwcm9ncmFtIGlzDQojIyB0 ZXN0LWNpcmNsZXMsIHdoaWNoIGRlbW9uc3RyYXRlcyBob3cgYSBwb2x5Z29u IG1hZGUgb2Ygc3RyYWlnaHQNCiMjIGxpbmVzIGNhbiBjb252ZXJnZSB0byBh IGNpcmNsZS4NCg0KZnJvbSBncmFwaGljcyBpbXBvcnQgKg0KZnJvbSB0aW1l IGltcG9ydCBzbGVlcA0KZnJvbSBtYXRoIGltcG9ydCBwaSwgY29zLCBzaW4N Cg0KIyMgVHJ5IHJ1bm5pbmcgdGVzdENpcmNsZXMgd2l0aCBuPTQwIGFuZCBk ZWxheT0uNSBmb3IgYSBuaWNlIGFuaW1hdGluZw0KIyMgZWZmZWN0Lg0KZGVm IHRlc3RDaXJjbGVzKG4sIGRlbGF5KToNCiAgICBjaXJjbGVfcmFkaXVzID0g MTcwDQogICAgZm9yIG4gaW4gcmFuZ2UoMywgbiszKToNCiAgICAgICAgY2xl YXJHcmFwaGljcygpDQogICAgICAgIGRyYXdDbG9zZWRQb2x5Z29uKG1ha2VO UG9seWdvbihjaXJjbGVfcmFkaXVzLCBuKSkNCiAgICAgICAgc2xlZXAoZGVs YXkpDQoNCiMjIEhlcmUncyB0aGUgaGVhcnQgb2YgdGhlIHByb2dyYW06IGdp dmVuIHJhZGl1cyBhbmQgbiwgcmV0dXJucyBiYWNrDQojIyB0byB1cyBhIGxp c3Qgb2YgcG9pbnRzIHRoYXQgc2hvdWxkIGNvbnN0cnVjdCBhIHJlZ3VsYXIg bi1wb2x5Z29uDQojIyB3aG9zZSBwb2ludHMgYXJlIGFsbCByZWxhdGl2ZSB0 byAoMCwgMCkuDQpkZWYgbWFrZU5Qb2x5Z29uKHJhZGl1cywgbik6DQogICBk ZWdyZWVzID0gZGl2aWRlVXAzNjBJbnRvRGVncmVlcyhuKQ0KICAgdGhldGFz ID0gbWFwKGRlZ1RvUmFkLCBkZWdyZWVzKQ0KICAgcmV0dXJuIFtwb2xhclRv UmVjdChyYWRpdXMsIHQpIGZvciB0IGluIHRoZXRhc10NCg0KDQojIyBEcmF3 cyBhIGNsb3NlZCBwb2x5Z29uIG9mIHBvaW50cy4gIEZvciBleGFtcGxlOg0K IyMgICAgZHJhd0Nsb3NlZFBvbHlnb24oWygxMDAgMCksICgxMDAgMTAwKSwg KDAgMCldKQ0KIyMgc2hvdWxkIGRyYXcgYSBzbWFsbCB0cmlhbmdsZS4NCmRl ZiBkcmF3Q2xvc2VkUG9seWdvbihwb2ludHMpOg0KICAgIHBvaW50cyA9IHBv aW50cyArIFtwb2ludHNbMF1dDQogICAgZm9yIGkgaW4gcmFuZ2UobGVuKHBv aW50cykgLSAxKToNCiAgICAgICAgKCh4MSwgeTEpLCAoeDIsIHkyKSkgPSAo cG9pbnRzW2ldLCBwb2ludHNbaSsxXSkNCiAgICAgICAgZHJhd0xpbmUoeDEs IHkxLCB4MiwgeTIpDQoNCg0KIyMgVGFrZXMgaW4gYSByYWRpdXMgYW5kIGFu IHRoZXRhIGluIHJhZGlhbnMsIGdpdmVzIGJhY2sgdG8gdXMgdGhlDQojIyBw YXJ0aWN1bGFyICh4LHkpIGNvb3JkaW5hdGUgdGhhdCBtYXRjaGVzIHRoaXMg ZGVzY3JpcHRpb24uDQpkZWYgcG9sYXJUb1JlY3QocmFkaXVzLCB0aGV0YSk6 DQogICAgcmV0dXJuIChyYWRpdXMgKiBjb3ModGhldGEpLCByYWRpdXMgKiBz aW4odGhldGEpKQ0KDQoNCiMjIGRlZ1RvUmFkIGFuZCByYWRUb0RlZyBjb252 ZXJ0IGJldHdlZW4gcmFkaWFucyBhbmQgZGVncmVlcyBhY2NvcmRpbmcNCiMj IHRvIHRoZSBlcXVhbGl0eTogMSBkZWdyZWUgPSAocGkvMTgwKSByYWRpYW5z LiAgV2UnbGwgbmVlZCB0aGlzDQojIyBiZWNhdXNlIFB5dGhvbidzIHRyaWdv bm9tZXRyaWMgZnVuY3Rpb25zIGRlYWwgZW50aXJlbHkgd2l0aA0KIyMgcmFk aWFucywgd2hpbGUgaHVtYW5zIHVzdWFsbHkgYXJlIG1vcmUgY29tZm9ydGFi bGUgd2l0aCBkZWdyZWVzLg0KZGVmIGRlZ1RvUmFkKGRlZ3JlZXMpOiByZXR1 cm4gZGVncmVlcyAqIHBpIC8gMTgwDQpkZWYgcmFkVG9EZWcocmFkaWFucyk6 IHJldHVybiAoMTgwICogcmFkaWFucykgLyBwaQ0KDQoNCiMjIEdpdmVuIG4s IHJldHVybnMgYSBsaXN0IG9mIGRlZ3JlZXMgdGhhdCBlcXVhbGx5IGRpdmlk ZSAzNjAgZGVncmVlcy4NCiMjIEZvciBleGFtcGxlLCBhIHRyaWFuZ2xlIGNl bnRlcmVkIGF0IHRoZSBvcmlnaW4gaGFzIHZlcnRpY2VzIG9yaWVudGVkDQoj IyBhdCAwLCAxMjAsIGFuZCAyNDAgYW5nbGVzLg0KZGVmIGRpdmlkZVVwMzYw SW50b0RlZ3JlZXMobik6DQogICAgYW5nbGUgPSAzNjAuMCAvIG4NCiAgICBy ZXR1cm4gW2FuZ2xlICogeCBmb3IgeCBpbiByYW5nZShuKV0NCg0KDQo= --545289610-2072271115-989456109=:29220 Content-Type: TEXT/PLAIN; charset=US-ASCII; name="graphics.py" Content-Transfer-Encoding: BASE64 Content-ID: Content-Description: Content-Disposition: attachment; filename="graphics.py" IiIiVGhpcyBpcyBhIHNtYWxsIGdyYXBoaWNzIG1vZHVsZSB0aGF0IG1pbWlj cyBzb21lIHRoZSBmdW5jdGlvbmFsaXR5DQpvZiB3aGF0IHRoZSBDUzMgc3R1 ZGVudHMgdXNlIHRvIGRvIGZyYWN0YWwgZ3JhcGhpY3MuICBJdCdzIHNpbXBs aWZpZWQNCmJlY2F1c2UgdGhlIGNvb3JkaW5hdGVzIGFyZSBjZW50ZXJlZCBh dCAoMCwgMCkgaW4gdGhlIG1pZGRsZSBvZiB0aGUNCnNjcmVlbiBhbmQgaXQg dXNlcyBmYW1pbGlhciBjb29yZGluYXRlIG9yaWVudGF0aW9uLiIiIg0KDQoj IEknbSB0cnlpbmcgdG8gbWFrZSB0aGlzIGltcG9ydCBzYWZlLg0KDQppbXBv cnQgVGtpbnRlcg0KaW1wb3J0IHN0cmluZw0KDQpjbGFzcyBHcmFwaGljczoN CiAgICBkZWYgX19pbml0X18oc2VsZiwgcm9vdCk6DQogICAgICAgIHNlbGYu X3Jvb3QgPSByb290DQogICAgICAgIHNlbGYuX3hwb3MsIHNlbGYuX3lwb3Mg PSAwLCAwDQogICAgICAgIHNlbGYuX3dpZHRoID0gNDAwDQogICAgICAgIHNl bGYuX2hlaWdodCA9IDQwMA0KICAgICAgICBzZWxmLl9yZ2IgPSAnIzAwMDAw MCcgICMgRGVmYXVsdCBzaG91bGQgYmUgYmxhY2sNCiAgICAgICAgc2VsZi5f Y2FudmFzID0gVGtpbnRlci5DYW52YXMoc2VsZi5fcm9vdCwgd2lkdGg9c2Vs Zi5fd2lkdGgsDQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgIGhlaWdodD1zZWxmLl9oZWlnaHQsIGJnPSd3aGl0ZScpDQogICAgICAg IHNlbGYuX2NhbnZhcy5wYWNrKCkNCiAgICAgICAgc2VsZi5jbGVhckdyYXBo aWNzKCkNCg0KICAgIGRlZiBjbGVhckdyYXBoaWNzKHNlbGYpOg0KICAgICAg ICAiIiJDbGVhciB0aGUgc2NyZWVuIG9mIGFsbCBkcmF3aW5ncy4iIiINCiAg ICAgICAgZm9yIGlkIGluIHNlbGYuX2NhbnZhcy5maW5kX2FsbCgpOg0KICAg ICAgICAgICAgc2VsZi5fY2FudmFzLmRlbGV0ZShpZCkNCg0KICAgIGRlZiBw b3NpdGlvblBlbihzZWxmLCB4LCB5KToNCiAgICAgICAgIiIiTW92ZSB0aGUg cGVuIHRvIHRoZSBzcGVjaWZpYyBwb3NpdGlvbi4iIiINCiAgICAgICAgc2Vs Zi5feHBvcywgc2VsZi5feXBvcyA9IHgsIHkNCg0KICAgIGRlZiBkcmF3TGlu ZVRvKHNlbGYsIHgsIHkpOg0KICAgICAgICAiIiJEcmF3IHRoZSBsaW5lIGZy b20gdGhlIGN1cnJlbnQgcG9zaXRpb24gdG8gKHgsIHkpLg0KICAgICAgICBB cyBhIHNpZGUgZWZmZWN0LCB0aGUgY3VycmVudCBwb3NpdGlvbiBiZWNvbWVz ICh4LCB5KS4iIiINCiAgICAgICAgeDEsIHkxID0gc2VsZi5jb252ZXJ0Q29v cmQoc2VsZi5feHBvcywgc2VsZi5feXBvcykNCiAgICAgICAgeDIsIHkyID0g c2VsZi5jb252ZXJ0Q29vcmQoeCwgeSkNCiAgICAgICAgc2VsZi5fY2FudmFz LmNyZWF0ZV9saW5lKHgxLCB5MSwgeDIsIHkyLCBmaWxsPXNlbGYuX3JnYikN CiAgICAgICAgc2VsZi5fY2FudmFzLnVwZGF0ZSgpDQogICAgICAgIHNlbGYu cG9zaXRpb25QZW4oeCwgeSkNCg0KICAgIGRlZiBkcmF3TGluZShzZWxmLCB4 MSwgeTEsIHgyLCB5Mik6DQogICAgICAgICIiIkRyYXcgYSBsaW5lIGZyb20g KHgxLCB5MSkgdG8gKHgyLCB5MikuICBBcyBhIHNpZGUgZWZmZWN0LA0KICAg ICAgICB0aGUgY3VycmVudCBwb3NpdGlvbiBiZWNvbWVzICh4MiwgeTIpLiIi Ig0KICAgICAgICBzZWxmLnBvc2l0aW9uUGVuKHgxLCB5MSkNCiAgICAgICAg c2VsZi5kcmF3TGluZVRvKHgyLCB5MikNCg0KICAgIGRlZiBkcmF3UG9pbnQo c2VsZiwgeCwgeSk6DQogICAgICAgICIiIkRyYXcgYSBzaW5nbGUgcG9pbnQg YXQgKHgsIHkpLiAgQXMgYSBzaWRlIGVmZmVjdCwNCiAgICAgICAgdGhlIGN1 cnJlbnQgcG9zaXRpb24gYmVjb21lcyAoeCwgeSkuIiIiDQogICAgICAgIHNl bGYucG9zaXRpb25QZW4oeDEsIHkxKQ0KICAgICAgICB4MSwgeTEgPSBzZWxm LmNvbnZlcnRDb29yZCh4LCB5KQ0KICAgICAgICBzZWxmLl9jYW52YXMuY3Jl YXRlX292YWwoeDEsIHkxLCB4MSwgeTEsIG91dGxpbmU9c2VsZi5fcmdiKQ0K ICAgICAgICBzZWxmLl9jYW52YXMudXBkYXRlKCkNCg0KICAgIGRlZiBjbGVh clBvaW50KHNlbGYsIHgsIHkpOg0KICAgICAgICAiIiJDbGVhcnMgYSBzaW5n bGUgcG9pbnQgYXQgKHgsIHkpLiAgQXMgYSBzaWRlIGVmZmVjdCwNCiAgICAg ICAgdGhlIGN1cnJlbnQgcG9zaXRpb24gYmVjb21lcyAoeCwgeSkuIiIiDQog ICAgICAgIHNlbGYucG9zaXRpb25QZW4oeDEsIHkxKQ0KICAgICAgICBiZ2Nv bG9yID0gc2VsZi5fY2FudmFzLmNnZXQoJ2JnJykNCiAgICAgICAgeDEsIHkx ID0gc2VsZi5jb252ZXJ0Q29vcmQoeCwgeSkNCiAgICAgICAgc2VsZi5fY2Fu dmFzLmNyZWF0ZV9vdmFsKHgxLCB5MSwgeDEsIHkxLCBvdXRsaW5lPWJnY29s b3IpDQogICAgICAgIHNlbGYuX2NhbnZhcy51cGRhdGUoKQ0KICAgIA0KICAg IGRlZiBncmFwaGljc1RleHQoc2VsZiwgbXNnLCB4LCB5KToNCiAgICAgICAg IiIiV3JpdGVzIGEgbGluZSBvZiB0ZXh0LCBsZWZ0IGp1c3RpZmVkIGZyb20g KHgsIHkpLiIiIg0KICAgICAgICB4MSwgeTEgPSBzZWxmLmNvbnZlcnRDb29y ZCh4LCB5KQ0KICAgICAgICBzZWxmLl9jYW52YXMuY3JlYXRlX3RleHQoeDEs IHkxLCB0ZXh0PW1zZywgZmlsbD1zZWxmLl9yZ2IpDQogICAgICAgIHNlbGYu X2NhbnZhcy51cGRhdGUoKQ0KICAgIA0KICAgIGRlZiBzZXRSR0JDb2xvcihz ZWxmLCByLCBnLCBiKToNCiAgICAgICAgIiIiQ2hhbmdlcyB0aGUgY3VycmVu dCBjb2xvciB0byAociwgZywgYiksIHdoZXJlDQogICAgICAgIGVhY2ggY29t cG9uZW50IGlzIGEgdmFsdWUgYmV0d2VlbiAwIGFuZCAyNTUuIiIiDQogICAg ICAgIHNlbGYuX3JnYiA9ICcjJTAyWCUwMlglMDJYJyAlIChyLCBnLCBiKQ0K DQogICAgZGVmIGNvbnZlcnRDb29yZChzZWxmLCB4LCB5KToNCiAgICAgICAg bmV3eCA9IHNlbGYuX3dpZHRoLzIgKyB4DQogICAgICAgIG5ld3kgPSBzZWxm Ll9oZWlnaHQvMiAtIHkNCiAgICAgICAgcmV0dXJuIG5ld3gsIG5ld3kNCg0K DQoNCiIiIkhlcmUgYXJlIHNvbWUgZ2xvYmFsIGZ1bmN0aW9ucyBhbmQgdmFy aWFibGVzIHRvIG1ha2UgdGhpbmdzIGVhc2llcg0KZm9yIGEgYmVnaW5uZXIg dW5hY2N1c3RvbWVkIHRvIE9PUC4gIE5vdGU6IHRoaXMgaXMgdWdseSBiZWNh dXNlIHdlDQpuZWVkIGFuIGV4dHJhIGxldmVsIG9mIGluZGlyZWN0aW9uIGhl cmU6IHdlIHdhbnQgdG8gbWFrZSAiZnJvbQ0KZ3JhcGhpY3MgaW1wb3J0ICoi IHdvcmssIGJ1dCB0aGlzIHRha2VzIHNvbWUgc2lsbGluZXNzIHRvIGdldCBp dA0Kd29ya2luZyB3ZWxsLiAgTWlzZXJ5IG9mIHRoZSBmZXcgZm9yIHRoZSBq b3kgb2YgdGhlIG1hbnkuICAqZ3JpbioiIiINCg0KDQoiIiJPdXIgZ2xvYmFs IGdyYXBoaWNzIG9iamVjdC4iIiINCl9fZ3JhcGhpY3MgPSBOb25lDQoNCg0K IiIiRm9yIGVhY2ggb2YgdGhlIGludGVyZXN0aW5nIG1lbWJlciBmdW5jdGlv bnMgd2l0aGluIGEgR3JhcGhpY3MNCm9iamVjdCwgd2UnbGwgbWFrZSBhIGNv cnJlc3BvbmRpbmcgZ2xvYmFsIGZ1bmN0aW9uIHRoYXQgd29ya3Mgb24gYQ0K ZGVmYXVsdCB0b3BsZXZlbCB3aW5kb3cuICBUaGUgdHJpY2t5IHBhcnQgaXMg dG8gYWNjb3VudCBmb3Igd2hhdA0KaGFwcGVucyB3aGVuIHRoZSB1c2VyIGRl c3Ryb3lzIHRoZSB3aW5kb3c6IHdlIG5lZWQgdG8gZHluYW1pY2FsbHkNCnJl Y3JlYXRlIGFuZCBob29rIHRoZSBmdW5jdGlvbnMgYmFjayB1cCB0byBhIG5l dyBpbnN0YW5jZSBvZg0KR3JhcGhpY3MuICBUaGlzIGNvZGUgaXMgc3VidGxl IGFuZCBuZWVkcyBzb21lIGV4cGxhbmF0aW9uOg0KDQpXZSBleHBvc2UgdG8g dGhlIHVzZXIgdGhlIGxpc3Qgb2YgX193cmFwcGVkRnVuY3Rpb25zLiAgVW5k ZXJuZWF0aCwNCnRob3NlIGZ1bmN0aW9uIGFyZSBhY3R1YWxseSB3cmFwcGVy cyBhcm91bmQgdGhlIGFjdHVhbA0KaW1wbGVtZW50YXRpb25zLiAgRm9yIGV4 YW1wbGUsIHBvc2l0aW9uUGVuKCkgaXMganVzdCBhIHdyYXBwZXIgYXJvdW5k DQpfX3Bvc2l0aW9uUGVuKCkuDQoNCldoZW5ldmVyIG91ciBHcmFwaGljcyBv YmplY3QgaXMgZGVzdHJveWVkLCB3ZSBuZWVkIHRvIHJlaW5pdGlhbGl6ZSB0 aGUNCmltcGxlbWVudGF0aW9uIGZ1bmN0aW9ucyBhdCB0aGUgbWVtYmVycyBv ZiBfX2dyYXBoaWNzLiAgVGhpcyBpcyB3aGF0DQpfX3Jlc2V0R3JhcGhpY3Mo KSBkb2VzLiIiIg0KDQoNCg0KX193cmFwcGVkRnVuY3Rpb25zID0gc3RyaW5n LnNwbGl0KCIiInBvc2l0aW9uUGVuIGRyYXdMaW5lVG8gZHJhd0xpbmUNCmRy YXdQb2ludCBjbGVhclBvaW50IGdyYXBoaWNzVGV4dCBzZXRSR0JDb2xvciIi IikNCg0KDQoiIiJUaGUgZm9sbG93aW5nIGNyZWF0ZXMgYWxsIHRoZSBuaWNl IHdyYXBwZXIgZnVuY3Rpb25zLiIiIg0KX193cmFwcGVyVGVtcGxhdGUgPSAi IiINCmRlZiAlKGZ1bmN0aW9uX25hbWUpcygqYXJncyk6DQogICAgdHJ5OiBh cHBseShfXyUoZnVuY3Rpb25fbmFtZSlzLCBhcmdzKQ0KICAgIGV4Y2VwdCBU a2ludGVyLlRjbEVycm9yOg0KICAgICAgICBjbGVhckdyYXBoaWNzKCkNCiAg ICAgICAgYXBwbHkoX18lKGZ1bmN0aW9uX25hbWUpcywgYXJncykNCl9fJShm dW5jdGlvbl9uYW1lKXMgPSBOb25lDQoiIiINCmZvciBmdW5jdGlvbl9uYW1l IGluIF9fd3JhcHBlZEZ1bmN0aW9uczoNCiAgICBleGVjIF9fd3JhcHBlclRl bXBsYXRlICUgeydmdW5jdGlvbl9uYW1lJyA6IGZ1bmN0aW9uX25hbWV9DQoN Cg0KZGVmIGNsZWFyR3JhcGhpY3MoKToNCiAgICBfX3Jlc2V0R3JhcGhpY3Mo KQ0KICAgIF9fcmVzZXRGdW5jdGlvbnMoKQ0KICAgIF9fZ3JhcGhpY3MuY2xl YXJHcmFwaGljcygpDQoNCg0KZGVmIF9fcmVzZXRHcmFwaGljcygpOg0KICAg IGdsb2JhbCBfX2dyYXBoaWNzDQogICAgaWYgVGtpbnRlci5fZGVmYXVsdF9y b290ID09IE5vbmU6DQogICAgICAgIFRraW50ZXIuX2RlZmF1bHRfcm9vdCA9 IFRraW50ZXIuVGsoKQ0KICAgICAgICBfX2dyYXBoaWNzID0gTm9uZQ0KICAg IGlmIF9fZ3JhcGhpY3MgPT0gTm9uZToNCiAgICAgICAgX19ncmFwaGljcyA9 IEdyYXBoaWNzKFRraW50ZXIuX2RlZmF1bHRfcm9vdCkNCg0KDQpkZWYgX19y ZXNldEZ1bmN0aW9ucygpOg0KICAgIHRlbXBsYXRlID0gJycnDQpnbG9iYWwg X18lKGZ1bmN0aW9uX25hbWUpcw0KX18lKGZ1bmN0aW9uX25hbWUpcyA9IF9f Z3JhcGhpY3MuJShmdW5jdGlvbl9uYW1lKXMNCicnJw0KICAgIGZvciBmdW5j dGlvbl9uYW1lIGluIF9fd3JhcHBlZEZ1bmN0aW9uczoNCiAgICAgICAgZXhl YyB0ZW1wbGF0ZSAlIHsnZnVuY3Rpb25fbmFtZScgOiBmdW5jdGlvbl9uYW1l fQ0KDQoNCiMjIExldCdzIHN0YXJ0IHRoZSBtYWdpYy4NCmNsZWFyR3JhcGhp Y3MoKQ0KDQo= --545289610-2072271115-989456109=:29220-- From HotToPot@aol.com Thu May 10 04:53:42 2001 From: HotToPot@aol.com (HotToPot@aol.com) Date: Wed, 9 May 2001 23:53:42 EDT Subject: [Edu-sig] Intro and question: assignments/projects for year end Message-ID: <75.146051c1.282b6ac6@aol.com> >If they only have about two weeks to "learn" Python, and write a small program >or two, what types of things could I have them do? We won't have time to get >into GUIs. These can't be very ambitious projects, due to the limited amount of >time. A suggestion\idea made without great conviction, and probably too general to be of great use: Don't ask them to face a blank page. If its Game of Life, start them with functioning code and challenge them to extend it in some fairly specific way. If its graphics, start with functioning code that draws lines, ask them to draw boxes and circles. Even at high levels of programming, few people are asked to face the blank page. One is extending, optimizing, debugging, porting, etc. Give them something broken to fix. Plant a few bugs. But don't ask them to face the blank page. ART From rob@jam.rr.com Thu May 10 04:56:30 2001 From: rob@jam.rr.com (Rob Andrews) Date: Wed, 09 May 2001 22:56:30 -0500 Subject: [Edu-sig] Intro and question: assignments/projects for year end References: <75.146051c1.282b6ac6@aol.com> Message-ID: <3AFA116E.3751E98E@jam.rr.com> There are a number of examples, beginner to intermediate in level, to be found at Useless Python, which is presented mainly by the Python Tutor email list. You might find some interesting ideas there. The URL is: http://www.lowerstandard.com/python/pythonsource.html Rob HotToPot@aol.com wrote: > > >If they only have about two weeks to "learn" Python, and write a small > program > >or two, what types of things could I have them do? We won't have time to get > >into GUIs. These can't be very ambitious projects, due to the limited amount > of > >time. > > A suggestion\idea made without great conviction, and probably too general > to be of great use: > > Don't ask them to face a blank page. > > If its Game of Life, start them with functioning code and challenge > them to extend it in some fairly specific way. > > If its graphics, start with functioning code that draws lines, ask them to > draw > boxes and circles. > > Even at high levels of programming, few people are asked to face the > blank page. One is extending, optimizing, debugging, porting, etc. > > Give them something broken to fix. Plant a few bugs. > > But don't ask them to face the blank page. > > ART > > _______________________________________________ > Edu-sig mailing list > Edu-sig@python.org > http://mail.python.org/mailman/listinfo/edu-sig -- Useless Python! If your Python is this useless, we need you. http://www.lowerstandard.com/python/pythonsource.html From pdx4d@teleport.com Thu May 10 05:15:39 2001 From: pdx4d@teleport.com (Kirby Urner) Date: Wed, 9 May 2001 21:15:39 -0700 Subject: [Edu-sig] Re: Determinants and permutations In-Reply-To: Message-ID: <000501c0d907$dfd74740$0802a8c0@KirbyUrner> > > I developed my permutations algorithm using the > backtracking approach, and its more general. Since > I had that algorithm ready, it was fairly easy to develop > the determinant algorithm too. > I'd be interested in learning more about your backtracking approach. Kirby From pdx4d@teleport.com Thu May 10 05:17:49 2001 From: pdx4d@teleport.com (Kirby Urner) Date: Wed, 9 May 2001 21:17:49 -0700 Subject: [Edu-sig] About myself In-Reply-To: <011401c0d8b3$3d813f40$c3090740@megapathdsl.net> Message-ID: <000601c0d908$2cf085a0$0802a8c0@KirbyUrner> Excellent points re the intimidating side of Python, Jason. Having computers set up and ready, with a curriculum handy, is one thing. But trying to start from scratch and write canned apps you can share as compiled binaries is something else again. Kirby From sheila@thinkspot.net Thu May 10 05:34:44 2001 From: sheila@thinkspot.net (Sheila King) Date: Wed, 09 May 2001 21:34:44 -0700 Subject: [Edu-sig] Intro and question: assignments/projects for year end In-Reply-To: <75.146051c1.282b6ac6@aol.com> References: <75.146051c1.282b6ac6@aol.com> Message-ID: First of all, I want to thank everyone for all the suggestion, both on this list and in e-mail. I'm going to try to get something specific together for my students by Friday. As for these comments below: On Wed, 9 May 2001 23:53:42 EDT, HotToPot@aol.com wrote about [Edu-sig] Intro and question: assignments/projects for year end : :Don't ask them to face a blank page. : :If its Game of Life, start them with functioning code and challenge :them to extend it in some fairly specific way. : :If its graphics, start with functioning code that draws lines, ask them to :draw :boxes and circles. : :Even at high levels of programming, few people are asked to face the :blank page. One is extending, optimizing, debugging, porting, etc. : :Give them something broken to fix. Plant a few bugs. : :But don't ask them to face the blank page. I wasn't going to make the class all do the same project. I was going to let them pick what they want to do. Last year I did this with the CMU Graphics library, and it was a great success. However, in this scenario, it was mostly necessary for them to "face a blank page". Well, let me qualify that: We did have two "demo" programs for them to examine. I'd like to thank Rob for suggesting the Useless Python site, as a reference. I think you're right. That's a good source for samples and examples. -- Sheila King http://www.thinkspot.net/sheila/ http://www.k12groups.org/ From rnd@onego.ru Thu May 10 07:02:59 2001 From: rnd@onego.ru (Roman Suzi) Date: Thu, 10 May 2001 10:02:59 +0400 (MSD) Subject: [Edu-sig] About myself In-Reply-To: <011401c0d8b3$3d813f40$c3090740@megapathdsl.net> Message-ID: On Wed, 9 May 2001, Jason Cunliffe wrote: hi! > Hi Roman > > Thanks for the intro.. > > I hope you stick around. You seem to be grappling with familiar problems. > > But I question anyone who implies xyz god/tool/method is the #1. > Everything and everybody has a context, needs, a past, a present and > future. Of course. > CASE STUDY: 12-year old want to learn 'programming' At this age kids are usually very "visually-inclined". They prefer nice, colorful pictures and interfaces to UNIX-like ones... > All that Unix culture oozing through the cracks, mysterious intros that > mention environment variables withuot explaing what the fuck they are and > how to set them, dubious Mac support [getting better again with MacOSX coudl > be much more Python friendly] no simple one-click executables without diving > through lots in clever READMEs. This kids wants to progam something and end > up with soemthnig which will work. A single binary object he can put on his > desktop, a disk or email to friend, show his doubting teachers. Python does > not encourage this, though it is becoming more and more possible. > > Well I believe Kirby's curriculum strategy is an essential step. > http://www.inetarena.com/~pdx4d/ocn/ I'll look at it. > Even if everyone got hit by a very special RCrumb meatball today or next > Tuesday, and said "OK! Wow - Let's start using nothing but Python for all > our teaching from now on" > Then they would have job #1 - figuring out how what and when and lack of > curriculum. > > Countries who have embraced Linux as national OS policy and have ambitious > plans active for computer education and network infsractucture are likely to > be the move Python in the classrom from enlightened experiment to reality. > South Korea for example. > > > (I am also a participant of Seul/EDU (Simple End User Linux, > > educational aspect. Python Edu-SIG /\ Seul-EDU != []. > > > > And a moderator of relcom.education newsgroup. > > Don't follow that. Thanks I'll look [the rest will be answered separately] Sincerely yours, Roman A.Suzi -- - Petrozavodsk - Karelia - Russia - mailto:rnd@onego.ru - From rnd@onego.ru Thu May 10 07:42:31 2001 From: rnd@onego.ru (Roman Suzi) Date: Thu, 10 May 2001 10:42:31 +0400 (MSD) Subject: [Edu-sig] About myself In-Reply-To: <011401c0d8b3$3d813f40$c3090740@megapathdsl.net> Message-ID: On Wed, 9 May 2001, Jason Cunliffe wrote: Hi Jason! > http://www.moock.org/asdg/ > sample chapters: > > What do you think of this as style/content for beginners? > > > Chapter 1 - A Gentle Introduction for Non-Programmers Overall very nice! The first chapter is alittle too verbose to impatient. Usually it is not very comfortable to feed beginners with philosophy. Me too done it and it was not usually understood. It seems, deduction doesn't work for most students. Them can't deduce from common "philosophical" phrases practical implications. I looked into Contents at the web: its traditional for programming books. I do not know if RealBasic is strongly typed or not, but for Python I think the better approach is to learn functions early and probably not to make stress on data types. For example: ------------------------------- First: 0. Dialog with Python (...,calculator,etc) Second: 1. Hello world 2. Arithmetics (Numbers) 3. Functions 4. Strings 5. Conditions 6. Boolean logic 7. Loops 8. Comments 9. Lists 10. Text processing (regular expressions included) 11. Formatting output 12. Files Third...: Functional style Modular style OOP style Fourth: IDLE Fifth: Debug, optimization summarised ---------------------- One more point. Flash is about more visual art than text processing, for example. When I teached HyperCard we touched programming very gently, as an aux. tools. (Despite even the fact that I myself dislike WISYWIG) Sincerely yours, Roman A.Suzi -- - Petrozavodsk - Karelia - Russia - mailto:rnd@onego.ru - From rhseabrook@mail.aacc.cc.md.us Thu May 10 20:46:38 2001 From: rhseabrook@mail.aacc.cc.md.us (Seabrook, Richard) Date: Thu, 10 May 2001 12:46:38 -0700 Subject: [Edu-sig] Python Briefing for Faculty Message-ID: <5.0.0.25.0.20010510123404.02290710@mail.aacc.cc.md.us> I'm putting together a 2-3 hour briefing + demonstration for faculty to try to get them interested in Python for our introductory programming course, which uses a baffling subset of C++ at the moment. I thought I'd do it in a PC lab with Win2000 and use Python 2.0 + IDLE. I teach Python under Linux, but I think the windoze environment will be more convincing for them, and engaging for beginning programming students. I plan to discuss programming environments, provide an overview of the language, and have them type in some small programs. Anyone done this recently? Have any thoughts to contribute? Thanks, Dick S. - rhseabrook@mail.aacc.cc.md.us Anne Arundel Community College (410)541-2424 *** Speed the net! http://enterprise.aacc.cc.md.us/~rhs From Brent.Burley@disney.com Thu May 10 19:54:52 2001 From: Brent.Burley@disney.com (Brent Burley) Date: Thu, 10 May 2001 11:54:52 -0700 Subject: [Edu-sig] Re: Intro and question: assignments/projects for year end Message-ID: <3AFAE3FC.24BF1671@fa.disney.com> HotToPot@aol.com wrote: > If its Game of Life, start them with functioning code and challenge > them to extend it in some fairly specific way. > ... > But don't ask them to face the blank page. I've prepared something along these lines. I've written a functioning Reversi game that provides a framework for defining new computer player strategies. It's meant as a general programming project and an introduction to AI. There's an accompanying tutorial. See http://erburley.home.netcom.com/Reversi-index.html Reversi is one of the first games I programmed (in high school, in BASIC on an Apple II+). I rewrote this game several times in various languages on various computers as I learned more about programming and AI. Most high school students would probably rather learn to program arcade games and graphics. I think that's fine and I'm interested in making some materials that could be used to that end. However, for the right student, I think AI programming can be a more interesting programming problem since it causes you to think about how humans think, how computers think, how they are related and how they are different. Brent From gritsch@iue.tuwien.ac.at Thu May 10 21:45:09 2001 From: gritsch@iue.tuwien.ac.at (Markus Gritsch) Date: Thu, 10 May 2001 22:45:09 +0200 Subject: [Edu-sig] Python Briefing for Faculty References: <5.0.0.25.0.20010510123404.02290710@mail.aacc.cc.md.us> Message-ID: <002301c0d992$209ebb20$759322c3@telekabel.at> > I'm putting together a 2-3 hour briefing + demonstration for faculty to try > to get them interested in Python for our introductory programming course, > which uses a baffling subset of C++ at the moment. I thought I'd do it in > a PC lab with Win2000 and use Python 2.0 + IDLE. Maybe you want to consider to have a look at SciTE: http://www.scintilla.org/SciTE.html SciTE is a Text Editor with many nice features like syntax highlighting for many languages and filetypes (including Python), executing the Python-script by pressing F5 which raises an output area, jump to tracebacks by pressing F4, which makes hunting down errors very convenient. The Python interpreter is started in a separate process (very important for VPython programs). It is available on Win32 and Unix/Linux. It supports .api files which give you calltips for Python functions and classes which is also a very nice feature: http://stud4.tuwien.ac.at/~e9326522/gen_python_api.zip SciTE has support for multiple buffers and is quite configurable in any way. I do all my Python development with SciTE and prefere it to IDLE. Kind Regards, Markus From richard@sj.co.uk Thu May 10 23:01:01 2001 From: richard@sj.co.uk (Richard Crook) Date: Thu, 10 May 2001 23:01:01 +0100 Subject: [Edu-sig] Graphics for beginners, and other resources In-Reply-To: Message-ID: <1693183264.989535661@[10.1.0.9]> I don't normally shout much about our resources, but the list seems recently to have been discussing areas where we might be able to save folks some work. LiveWires is a computing holiday in the UK for 12-15 year olds; all our course material and Python modules is on our website. In particular, we have a support library to provide (Tk-based) graphics in a window with a straight procedural interface for beginners (similar to that described recently by Daniel Yoo). Daniel: apologies, I haven't yet had time to take a detailed look at what you've done, but you might find our course materials relevant anyway... In addition, some of what Jason Cunliffe posted struck a chord, so there might be some synergy there -- we've been actively using these materials for a couple of years to teach real beginners. I know Jeff Elkner has also picked up on this for some of his students (Hi Jeff!). Website at http://www.livewires.org.uk/python/index.html, for anyone interested. Feel free to comment -- we're in the process of updating and extending for this year's holiday. If anyone's interested in the directions we're going from here, drop me a message. Regards, Richard -- Richard Crook // SJ Consulting Ltd, Cambridge // richard@sj.co.uk From pdx4d@teleport.com Thu May 10 23:08:05 2001 From: pdx4d@teleport.com (Kirby Urner) Date: Thu, 10 May 2001 15:08:05 -0700 Subject: [Edu-sig] Technical question In-Reply-To: <002301c0d992$209ebb20$759322c3@telekabel.at> Message-ID: <001301c0d99d$b09c4ca0$0802a8c0@KirbyUrner> I have a pyfraction.py and a polynomial.py, which contain Fraction and Poly classes respectively. My problem is each class needs to know about the other, meaning I'm now doing an isinstance(other,Fraction) in Poly, and an isinstance(other,Poly) in Fraction. So how do I handle this. I have an import Fraction from pyfraction at the top of polynomial.py, and an import Poly from polynomial at the top of pyfraction.py This is obviously NOT the way to handle it, because it's a loop. In trying to import Fraction, it hits the line to import polynomial, which it's still trying to deal with. This problem arises now that I'm using isinstance(foo,bar) and need bar as a global. Earlier, I was doing type(foo).__class__.__name__ == "bar", which was ugly, but didn't require that I actually have any bars hangin' around. Kirby From pdx4d@teleport.com Fri May 11 00:20:23 2001 From: pdx4d@teleport.com (Kirby Urner) Date: Thu, 10 May 2001 16:20:23 -0700 Subject: [Edu-sig] Python Briefing for Faculty In-Reply-To: <002301c0d992$209ebb20$759322c3@telekabel.at> Message-ID: <000001c0d9a7$ca7f9aa0$0802a8c0@KirbyUrner> -----Original Message----- From: edu-sig-admin@python.org [mailto:edu-sig-admin@python.org]On Behalf Of Markus Gritsch Sent: Thursday, May 10, 2001 1:45 PM To: Seabrook, Richard; edu-sig@python.org Subject: Re: [Edu-sig] Python Briefing for Faculty > I'm putting together a 2-3 hour briefing + demonstration for faculty to try > to get them interested in Python for our introductory programming course, > which uses a baffling subset of C++ at the moment. I thought I'd do it in > a PC lab with Win2000 and use Python 2.0 + IDLE. Maybe you want to consider to have a look at SciTE: http://www.scintilla.org/SciTE.html <> SciTE has support for multiple buffers and is quite configurable in any way. I do all my Python development with SciTE and prefere it to IDLE. Kind Regards, Markus ============ scintilla looks interesting. I have a question about it though. In IDLE, I can assign variables and they persist, as do references to whatever imported stuff. As I do this and that interactively, I make use of these references -- I'm sitting in a pile of tools and they all stay defined from one command to the next (plus I create new ones at will). It's like using a calculator with any number of STORE keys, plus you can store anything you like (objects of any kind -- which may be functions). With scintilla, it looks like I boot an instance of Python every time I invoke a command (e.g. print 'hi'), plus I have to disk-save that command as a .py file in advance before I can use it. I'm not really in an interactive mode at all, but am executing a whole py module top to bottom and then exiting Python. If so, this seriously detracts from some of the benefits associated with IDLE, and even with interactive Python in a DOS box. You don't really have an environment. Nothing persists except disk files. You can't define A = Matrix(...) and then refer to it 10 minutes later, after doing a bunch of other stuff, maybe passing it as an argument to something imported from another module. There's no real conversation. Do I have the wrong idea here? If I'm correct, then scintilla may well be a very useful text editor, and good for doing *some* things in Python, but it's not creating a trully interactive Python session (using "session" as we might in APL, Logo or DrScheme -- interactive access to persistent data without saving to files). Maybe people coming from C++ or Java or Fortran don't really miss being in a session, having a true command line, because these are compile-link-run type languages. But those of us used to sitting in a command window and working interactively really notice when that power is suddenly gone (which doesn't mean we don't code in edit mode -- just that being in edit mode is not entirely synonymous with "using the language", is only half the story). Kirby From schoen@loyalty.org Fri May 11 01:55:37 2001 From: schoen@loyalty.org (Seth David Schoen) Date: Thu, 10 May 2001 17:55:37 -0700 Subject: [Edu-sig] Technical question In-Reply-To: <001301c0d99d$b09c4ca0$0802a8c0@KirbyUrner>; from pdx4d@teleport.com on Thu, May 10, 2001 at 03:08:05PM -0700 References: <002301c0d992$209ebb20$759322c3@telekabel.at> <001301c0d99d$b09c4ca0$0802a8c0@KirbyUrner> Message-ID: <20010510175537.A5636@zork.net> Kirby Urner writes: > I have a pyfraction.py and a polynomial.py, which contain > Fraction and Poly classes respectively. > > My problem is each class needs to know about the other, > meaning I'm now doing an isinstance(other,Fraction) in > Poly, and an isinstance(other,Poly) in Fraction. > > So how do I handle this. I have an > > import Fraction from pyfraction > > at the top of polynomial.py, and an > > import Poly from polynomial > > at the top of pyfraction.py > > This is obviously NOT the way to handle it, because > it's a loop. In trying to import Fraction, it hits the > line to import polynomial, which it's still trying to > deal with. > > This problem arises now that I'm using isinstance(foo,bar) > and need bar as a global. Earlier, I was doing > type(foo).__class__.__name__ == "bar", which was ugly, > but didn't require that I actually have any bars hangin' > around. I didn't have any trouble with a mutual import under Python 1.5.2: sample.py: #!/usr/bin/python import woo class Ample: def __init__(self): self.woo = woo.Woohoo() woo.py: #!/usr/bin/python import sample class Woohoo: def __init__(self): pass def gimmeanample(self): return sample.Ample() -- Seth David Schoen | And do not say, I will study when I Temp. http://www.loyalty.org/~schoen/ | have leisure; for perhaps you will down: http://www.loyalty.org/ (CAF) | not have leisure. -- Pirke Avot 2:5 From pdx4d@teleport.com Fri May 11 04:29:25 2001 From: pdx4d@teleport.com (Kirby Urner) Date: Thu, 10 May 2001 20:29:25 -0700 Subject: [Edu-sig] Technical question In-Reply-To: <20010510175537.A5636@zork.net> Message-ID: <000401c0d9ca$947cc540$0802a8c0@KirbyUrner> Thanks Seth. Now that I'm following your example and importing the module, vs using import foo from bar, and writing type(woo,bar.foo) instead of type(woo,foo), it's working OK. I'm not sure that's the issue. It could be a path thing somehow, in the python21\ocn\mathobjects, which contains an __init__.py, isn't in my python path (\ocn is though). I go from mathobjects import *, and that brings Fraction, Poly, Matrix and Sqmatrix top level. Anyway, your example led me to working code. >>> from mathobjects import * >>> f = Fraction(1,2) >>> p = Poly([1,0],'t') >>> p t >>> f (1/2) >>> p*f (1/2)*t >>> f*p (1/2)*t Gratefully, Kirby -----Original Message----- From: edu-sig-admin@python.org [mailto:edu-sig-admin@python.org]On Behalf Of Seth David Schoen Sent: Thursday, May 10, 2001 5:56 PM To: edu-sig@python.org Subject: Re: [Edu-sig] Technical question I didn't have any trouble with a mutual import under Python 1.5.2: <> From Arthinator@aol.com Fri May 11 05:20:23 2001 From: Arthinator@aol.com (Arthinator@aol.com) Date: Fri, 11 May 2001 00:20:23 EDT Subject: [Edu-sig] re: Python Briefing for Faculty Message-ID: --part1_d.1464084a.282cc287_boundary Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Kirby writes >In IDLE, I can assign variables and they persist, as do referencesto whatever >imported stuff. As I do this and that interactively, I make use of these references >-- I'm sitting in a pile of tools and they all stay defined from one command to the >next (plus Icreate new ones at will). I am and am not following you. Certainly I agree with you as to the importance of interactive mode, especially when configured for learning. Probably what attracted me most about Python initially was the clean and accessible interactive mode, where I could experiment and get my bearings. But my own work habits now are a text editor I had gotten accustomed to pre-IDLE, and IDLE for interactive mode - often open simultaneously. Never really gave IDLE a chance as my primary editor. Mostly just inertia . But I do see in it the design elegance I admire in Python, and love that its all just Python being Python. Based on my reading good code to learn coding theory, had spent some time with the IDLE code some time back trying to follow it best I could. Actually got a lot out of it. Biggest challenge at that stage for me was sorting out what was Tkinter specific and what was general Python. Have not used scintilla itself, but a quick look at the page indicates it to be a programmers editor. So I wouldn't expect it to have anything to do with interactive mode Python. Which of course is always available to you through IDLE, even with scintilla, etc. open and in use. Anyway, think you should see my point as to why I don't fully see what you are driving at. ART --part1_d.1464084a.282cc287_boundary Content-Type: text/html; charset="US-ASCII" Content-Transfer-Encoding: 7bit Kirby writes

>In IDLE, I can assign variables and they persist, as do referencesto
whatever >imported stuff.  As I do this and that interactively, I make use of
these references  >-- I'm sitting in a pile of tools and they all stay
defined from one command to the >next (plus Icreate new ones at will).  

I am and am not following you.  Certainly I agree with you as to the
importance
of interactive mode, especially when configured for learning.  

Probably what attracted me most about Python initially was the  clean and
accessible interactive mode, where I could experiment and get my bearings.

But my own work habits now are a text editor I had gotten accustomed to
pre-IDLE, and IDLE  for interactive mode - often open simultaneously.
Never really gave IDLE a chance as my primary editor.  Mostly just inertia .
But I do see in it the design elegance I admire in Python, and love that its
all just Python being Python.  

Based on my reading good code to learn coding theory, had spent some time  
with the IDLE code some time back trying to follow it best I could.  Actually
got a
lot out of it.  Biggest challenge at that stage for me was sorting out what
was
Tkinter specific and what was general Python.

Have not used scintilla itself, but a quick look at the page indicates it to
be a
programmers editor.  So I wouldn't expect it to have anything to do with
interactive mode Python.

Which of course is always available to you through IDLE, even with scintilla,
etc. open and in use.

Anyway, think you should see my point as to why I don't fully see what you
are driving at.

ART
--part1_d.1464084a.282cc287_boundary-- From pdx4d@teleport.com Fri May 11 05:42:59 2001 From: pdx4d@teleport.com (Kirby Urner) Date: Thu, 10 May 2001 21:42:59 -0700 Subject: [Edu-sig] re: Python Briefing for Faculty In-Reply-To: Message-ID: <000a01c0d9d4$db5a5b80$0802a8c0@KirbyUrner> Yeah, I think I was just knee-jerk responding to Markus concluding statement: "I do all my Python development with SciTE and prefere it to IDLE." When trying to demo Python to skeptical faculty, I'd want 'em to see the interactive mode too (shell mode) -- and scintilla doesn't do that. When teaching Python to kids, I'd *certainly* introduce them to Python in shell mode. So my only point is it's not either/or: fine to supplant IDLE as an editor, but you still need a shell of some kind to take full advantage of Python in interactive mode -- and an editor ain't a shell. I may go to scintilla as an editor for awhile, but I'll have IDLE open in another window as my shell, as you say (so far I like it better than ActivePython's shell). Kirby > Which of course is always available to you through IDLE, even with scintilla, > etc. open and in use. > > Anyway, think you should see my point as to why I don't fully see what you > are driving at. > > ART From sheila@thinkspot.net Fri May 11 06:02:45 2001 From: sheila@thinkspot.net (Sheila King) Date: Thu, 10 May 2001 22:02:45 -0700 Subject: [Edu-sig] Python Briefing for Faculty In-Reply-To: <002301c0d992$209ebb20$759322c3@telekabel.at> References: <5.0.0.25.0.20010510123404.02290710@mail.aacc.cc.md.us> <002301c0d992$209ebb20$759322c3@telekabel.at> Message-ID: <65BCF20222D@kserver.org> On Thu, 10 May 2001 22:45:09 +0200, "Markus Gritsch" wrote about Re: [Edu-sig] Python Briefing for Faculty: :The Python interpreter :is started in a separate process (very important for VPython programs). Is this not the case with PythonWin? I might introduce the VPython module to my students, but right now they only have IDLE and PythonWin on their computers. -- Sheila King http://www.thinkspot.net/sheila/ http://www.k12groups.org/ From gritsch@iue.tuwien.ac.at Fri May 11 07:36:03 2001 From: gritsch@iue.tuwien.ac.at (Markus Gritsch) Date: Fri, 11 May 2001 08:36:03 +0200 Subject: [Edu-sig] Python Briefing for Faculty References: <000001c0d9a7$ca7f9aa0$0802a8c0@KirbyUrner> Message-ID: <002901c0d9e4$a734cc40$759322c3@telekabel.at> > If so, this seriously detracts from some of the benefits associated > with IDLE, and even with interactive Python in a DOS box. You don't > really have an environment. Nothing persists except disk files. > You can't define A = Matrix(...) and then refer to it 10 minutes > later, after doing a bunch of other stuff, maybe passing it as an > argument to something imported from another module. There's no > real conversation. Everything you mentioned is totally correct. SciTE is an general Editor, but has no interactive window built in. I you enjoy interactive sessions, IDLE is definitely the tool to use. As you mentioned, It depends on your habbits. I don't use Python as an advanced calculator, and defining more complicated stuff (loops, conditions) on the commandline is awkward. Anyway, even when experimenting with features I write the code in SciTE and execute it. Since startup-time of the interpreter is neglible this is no problem, although there is no persistency (as you also mentioned). As already mentioned, it depends on your habbits. Regards, Markus From gritsch@iue.tuwien.ac.at Fri May 11 07:40:05 2001 From: gritsch@iue.tuwien.ac.at (Markus Gritsch) Date: Fri, 11 May 2001 08:40:05 +0200 Subject: [Edu-sig] Python Briefing for Faculty References: <5.0.0.25.0.20010510123404.02290710@mail.aacc.cc.md.us> <002301c0d992$209ebb20$759322c3@telekabel.at> <65BCF20222D@kserver.org> Message-ID: <002f01c0d9e5$36fd9320$759322c3@telekabel.at> > Is this not the case with PythonWin? > I might introduce the VPython module to my students, but right now they only > have IDLE and PythonWin on their computers. No, IIRC PythonWin and definitely IDLE start the scripts in their own Process space, which was one of the main reasons why VPython includes a modified version of IDLE which also uses a separate process for the programs to be executed. This is especially important when using while 1: do_some_stuff as is regularly found in VPython programs. Regards, Markus From gritsch@iue.tuwien.ac.at Fri May 11 07:41:30 2001 From: gritsch@iue.tuwien.ac.at (Markus Gritsch) Date: Fri, 11 May 2001 08:41:30 +0200 Subject: [Edu-sig] Python Briefing for Faculty References: <5.0.0.25.0.20010510123404.02290710@mail.aacc.cc.md.us> <5.0.0.25.0.20010510170748.0229b290@mail.aacc.cc.md.us> Message-ID: <003501c0d9e5$69890720$759322c3@telekabel.at> > Thanks for the suggestion! I got a copy of Scintilla some time ago but had > forgotten about it since I do most of my Python stuff under Linux using > vi. Maybe you should get a recent copy of SciTE before evaluating it since lots of things have been improved. Markus From pdx4d@teleport.com Fri May 11 15:44:41 2001 From: pdx4d@teleport.com (Kirby Urner) Date: Fri, 11 May 2001 07:44:41 -0700 Subject: [Edu-sig] Python Briefing for Faculty In-Reply-To: <002901c0d9e4$a734cc40$759322c3@telekabel.at> Message-ID: <000401c0da28$eb4839a0$0802a8c0@KirbyUrner> Yes, we agree. And I've downloaded and am using Scintilla now too, and I think I'm going to like it. Most of my curriculum writing around Python depends on the student importing modules and then interacting with them. "Advanced calculator" might be the term, but it's what Scheme, APL, Logo, Xbase and many other languages feature -- a shell. Basically, it's a way to get the user freedoms of event driven programming without having to write a fancy GUI (take advantage of the one you already have). >>> getfactors(100) [2,2,5,5] ... stuff like that. >From a beginner/learner/first language point of view, I think having a shell is a tremendous asset. If you can't go: >>> 1 + 1 2 or (+ 1 1) in Scheme, then I don't think it's very suitable, at least not for the math-through-programming curriculum type stuff I'm developing. Kirby =================== <> As already mentioned, it depends on your habbits. Regards, Markus _______________________________________________ Edu-sig mailing list Edu-sig@python.org http://mail.python.org/mailman/listinfo/edu-sig From jeff@elkner.net Fri May 11 17:58:20 2001 From: jeff@elkner.net (Jeffrey Elkner) Date: 11 May 2001 12:58:20 -0400 Subject: [Edu-sig] Graphics for beginners, and other resources In-Reply-To: <1693183264.989535661@[10.1.0.9]> References: <1693183264.989535661@[10.1.0.9]> Message-ID: <989600330.1017.6.camel@mdeicaza> The livewires course materials are excellent and have been a big help to me in our high school computer science program. They were written for middle school kids, but I find them particularly helpful with those students who find our textbook too difficult or too dry. The livewires materials are fun to use and engage these students in learning to program. Thanks Richard! On 10 May 2001 23:01:01 +0100, Richard Crook wrote: > I don't normally shout much about our resources, but the list seems > recently to have been discussing areas where we might be able to save folks > some work. > > LiveWires is a computing holiday in the UK for 12-15 year olds; all our > course material and Python modules is on our website. In particular, we > have a support library to provide (Tk-based) graphics in a window with a > straight procedural interface for beginners (similar to that described > recently by Daniel Yoo). Daniel: apologies, I haven't yet had time to take > a detailed look at what you've done, but you might find our course > materials relevant anyway... > > In addition, some of what Jason Cunliffe posted struck a chord, so there > might be some synergy there -- we've been actively using these materials > for a couple of years to teach real beginners. I know Jeff Elkner has also > picked up on this for some of his students (Hi Jeff!). > > Website at http://www.livewires.org.uk/python/index.html, for anyone > interested. Feel free to comment -- we're in the process of updating and > extending for this year's holiday. If anyone's interested in the directions > we're going from here, drop me a message. > > Regards, > Richard > -- > Richard Crook // SJ Consulting Ltd, Cambridge // richard@sj.co.uk From jasonic@nomadicsltd.com Sat May 12 12:01:28 2001 From: jasonic@nomadicsltd.com (Jason Cunliffe) Date: Sat, 12 May 2001 07:01:28 -0400 Subject: Scintilla was Re: [Edu-sig] Python Briefing for Faculty References: <000401c0da28$eb4839a0$0802a8c0@KirbyUrner> Message-ID: <005901c0dad2$e55ae2e0$c3090740@megapathdsl.net> I must have not missed something.. Isn't PythonWin using scintilla? I prefer PythonWin to IDLE most of the time. +++++ object.lookup command line completion pop up menu [YES!!] +++ easy to add new mdules to the PYTHONPATH [which I still do not really understand on win32] ++ nice color and formatting control ++ expand/contract code sections using 'Folding' option [free man's Mathematica-style notebook] + visible indentation guides [see View Menu] + configurable 'Tools' Menu + zoomable display CTRL + mousewheel + some Python modules that won't run under IDLE do under PythonWin - some Python modules that won't run under PythonWin do run under IDLE ./Jason _____________________________________________________ Jason CUNLIFFE = NOMADICS['Interactive Art and Technology'] From gritsch@iue.tuwien.ac.at Sat May 12 14:04:17 2001 From: gritsch@iue.tuwien.ac.at (Markus Gritsch) Date: Sat, 12 May 2001 15:04:17 +0200 Subject: Scintilla was Re: [Edu-sig] Python Briefing for Faculty References: <000401c0da28$eb4839a0$0802a8c0@KirbyUrner> <005901c0dad2$e55ae2e0$c3090740@megapathdsl.net> Message-ID: <000b01c0dae4$12d7b8e0$759322c3@telekabel.at> > Isn't PythonWin using scintilla? Yes it does, but scintilla is only the editor-component. Script-startup isn't performed by the editor-component, but by the embedding application. So SciTE is the text-editor which uses scintilla as it's editor-component. (In fact SciTE was only developed as a demonstration application for scintilla, but has improved so much, that it is a powerful editor now.) Try the following in the interactive window of PythonWin: while 1: pass and PyrthonWin will never ever respond to something again. > I prefer PythonWin to IDLE most of the time. > > +++++ object.lookup command line completion pop up menu [YES!!] can be done to some extend also with SciTE > +++ easy to add new mdules to the PYTHONPATH [which I still do not really > understand on win32] Ever looked at HKEY_LOCAL_MACHINE\Software\Python\PythonCore\2.0\PythonPath in the registry? > ++ nice color and formatting control More controllable in SciTE > ++ expand/contract code sections using 'Folding' option [free man's > Mathematica-style notebook] Code-folding is a feature of scintilla itself > + visible indentation guides [see View Menu] ditto > + configurable 'Tools' Menu comparable feature available in SciTE > + zoomable display CTRL + mousewheel CTRL Num+ in SciTE > + some Python modules that won't run under IDLE do under PythonWin > - some Python modules that won't run under PythonWin do run under IDLE There is no module that couldn't be run in SciTE. Every script is interruptable by a menu entry. Markus From jasonic@nomadicsltd.com Sat May 12 14:56:35 2001 From: jasonic@nomadicsltd.com (Jason Cunliffe) Date: Sat, 12 May 2001 09:56:35 -0400 Subject: Scintilla was Re: [Edu-sig] Python Briefing for Faculty References: <000401c0da28$eb4839a0$0802a8c0@KirbyUrner> <005901c0dad2$e55ae2e0$c3090740@megapathdsl.net> <000b01c0dae4$12d7b8e0$759322c3@telekabel.at> Message-ID: <001501c0daeb$5bccebe0$c3090740@megapathdsl.net> Hi Markus Many thanks for the heads up on SciTE. Very interstin & yes I am impressed - it does feels smooth, clean and fast. I like the Save As HTML/RTF/PDF How do you run python scripts? How do you do the object.lookup tricks? How do you navigate between multiple open files. There is no 'Window' menu to jump between open documents. I am probably just being lazy and nee to read the dosc adn study configs for a while. There has been a growing demand for a smart I toolkit for Zope. looks liek SciTE could be a very nice part of that, using wxPython/Boa. It's proabbly already in there.. Have you any experience embeding and scripting SciTE in python apps? cheers ./Jason ___________________________________________________________ Jason CUNLIFFE = NOMADICS['Interactive Art and Technology'] From jasonic@nomadicsltd.com Sat May 12 15:03:45 2001 From: jasonic@nomadicsltd.com (Jason Cunliffe) Date: Sat, 12 May 2001 10:03:45 -0400 Subject: [Edu-sig] SciTE config question on Win32 Message-ID: <001f01c0daec$5c7ff2c0$c3090740@megapathdsl.net> I need a jump start... SciTE will not run my python scripts yet. Does not respond to 'F5: Go' I opened python.properties ... if PLAT_WIN command.go.*.py=pythonw -u $(FileNameExt) command.go.subsystem.*.py=1 ... How should I set this up for running 1.5.2, 2.x etc.. I quite often need to switch between python. Various applications including Zope have their own python. thanks ./Jason ___________________________________________________________ Jason CUNLIFFE = NOMADICS['Interactive Art and Technology'] From gritsch@iue.tuwien.ac.at Sat May 12 15:38:01 2001 From: gritsch@iue.tuwien.ac.at (Markus Gritsch) Date: Sat, 12 May 2001 16:38:01 +0200 Subject: Scintilla was Re: [Edu-sig] Python Briefing for Faculty References: <000401c0da28$eb4839a0$0802a8c0@KirbyUrner> <005901c0dad2$e55ae2e0$c3090740@megapathdsl.net> <000b01c0dae4$12d7b8e0$759322c3@telekabel.at> <001501c0daeb$5bccebe0$c3090740@megapathdsl.net> Message-ID: <001401c0daf1$25a02680$759322c3@telekabel.at> This is a multi-part message in MIME format. ------=_NextPart_000_0011_01C0DB01.E8ABD740 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit > Hi Markus > > Many thanks for the heads up on SciTE. > > Very interstin & yes I am impressed - it does feels smooth, clean and fast. > I like the Save As HTML/RTF/PDF > > > How do you run python scripts? by pressing F5 (look into the SciTE docs) > How do you do the object.lookup tricks? Well, since it is only an Editor (although a very good one), and not a Python IDE, object.lookup is not possible. I wrote "to some extend possible", and that means, that calltips and autocompletion is possible. For example when configured properly, typing string. will pop up a window with all the functions an classes in the stirng module. Typing more e.g. string.split( will show the calltip of the function. This information must be stored in an .api file (as discribed in the SciTE docs), and I have written a little script which generates such an .api file form the standart Python library: stud4.tuwien.ac.at/~e9326522/gen_python_api.zip > How do you navigate between multiple open files. There is no 'Window' menu > to jump between open documents. You must turn on multiple buffers. Have a look into my attached SciTEUser.properties file. > I am probably just being lazy and nee to read the dosc adn study configs for > a while. In deed. But you can save some time by using parts of the attached file. It changes also the colors to be more IDLE like. > There has been a growing demand for a smart I toolkit for Zope. looks liek > SciTE could be a very nice part of that, using wxPython/Boa. It's proabbly > already in there.. > > Have you any experience embeding and scripting SciTE in python apps? No. And once again: SciTE is the Text Editor. SciTE, T=text E=editor. scintilla is the editor-component, and you definitely want to embed scintilla into your application. Please make this distinction. Enjoy, Markus ------=_NextPart_000_0011_01C0DB01.E8ABD740 Content-Type: application/octet-stream; name="SciTEUser.properties" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="SciTEUser.properties" # Glade Code Generator files=0A= file.patterns.glade=3D*.glade=0A= lexer.$(file.patterns.glade)=3Dxml=0A= if PLAT_WIN=0A= command.build.*.glade=3Dpython d:\bin\glc.py $(FileNameExt) = $(FileName).py=0A= if PLAT_GTK=0A= command.build.*.glade=3Dglc.py $(FileNameExt) $(FileName).py=0A= =0A= # Qt Designer files=0A= file.patterns.ui=3D*.ui=0A= lexer.$(file.patterns.ui)=3Dxml=0A= if PLAT_WIN=0A= command.build.*.ui=3Dpyuic.exe -o $(FileName).py -x $(FileNameExt)=0A= if PLAT_GTK=0A= command.build.*.ui=3Dpyuic $(FileNameExt) $(FileName).py=0A= =0A= # Python files=0A= if PLAT_WIN=0A= command.go.*.py=3Dpythonw -u $(FileNameExt) $(CurrentSelection)=0A= #command.go.*.py=3DD:\Python151\pythonw -u $(FileNameExt) = $(CurrentSelection)=0A= command.go.subsystem.*.py=3D1=0A= if PLAT_GTK=0A= command.go.*.py=3Dpython2 -u $(FileNameExt) $(CurrentSelection)=0A= =0A= cc=3Dg++ -pedantic -Os -fno-exceptions -fvtable-thunks -o $(FileName) = $(FileNameExt)=0A= command.build.*.c=3D$(cc)=0A= command.build.*.cc=3D$(cc)=0A= command.build.*.cpp=3D$(cc)=0A= command.build.*.cxx=3D$(cc)=0A= =0A= buffers=3D10=0A= tabbar.visible=3D1=0A= tabbar.hide.one=3D1=0A= tabbar.multiline=3D1=0A= =0A= if PLAT_WIN=0A= position.left=3D552=0A= #position.left=3D493=0A= position.top=3D0=0A= position.width=3D600=0A= #position.width=3D659=0A= position.height=3D700=0A= if PLAT_GTK=0A= position.left=3D-1=0A= position.top=3D-1=0A= position.width=3D600=0A= #position.width=3D731=0A= position.height=3D700=0A= =0A= view.whitespace=3D1=0A= view.indentation.whitespace=3D1=0A= view.indentation.guides=3D1=0A= highlight.indentation.guides=3D0=0A= =0A= eol.auto=3D1=0A= statusbar.visible=3D1=0A= statusbar.number=3D2 statusbar.size=3D1600 blank.margin.left=3D1 blank.margin.right=3D0=0A= margin.width=3D0=0A= caret.fore=3D#ff00ff=0A= caret.line.back=3D#FFFED8=0A= caret.period=3D0=0A= caret.width=3D2=0A= #selection.back=3D#FFE0E8=0A= #selection.back=3D#c0c0a8=0A= selection.fore=3D#ffffff=0A= selection.back=3D#808070=0A= =0A= split.vertical=3D0=0A= horizontal.scrollbar=3D0=0A= #output.horizontal.scrollbar=3D0=0A= clear.before.execute=3D1=0A= edge.mode=3D2=0A= edge.column=3D79=0A= strip.trailing.spaces=3D1=0A= default.file.ext=3D.py=0A= =0A= style.*.34=3Dfore:#00aa00,bold=0A= style.python.34=3Dfore:#00aa00,bold=0A= =0A= print.magnification=3D-2=0A= print.colour.mode=3D4=0A= =0A= fold=3D1=0A= fold.margin.width=3D0=0A= fold.use.plus=3D1=0A= #fold.on.open=3D1=0A= #title.full.path=3D1=0A= =0A= tabsize=3D4=0A= indent.size=3D4=0A= use.tabs=3D0=0A= =0A= are.you.sure=3D0=0A= are.you.sure.for.build=3D0=0A= #load.on.activate=3D1=0A= #save.on.deactivate=3D1=0A= =0A= if PLAT_WIN=0A= api.*.py=3Dd:\wscite\python.api=0A= if PLAT_GTK=0A= api.*.py=3D/iuehome/gritsch2/gscite/python.api=0A= calltip.python.word.characters=3D._$(chars.alpha)$(chars.numeric)=0A= autocomplete.python.start.characters=3D.=0A= #autocompleteword.automatic=3D1=0A= word.characters.*.py=3D$(chars.alpha)$(chars.numeric)_=0A= autocomplete.choose.single=3D1=0A= =0A= caret.policy.strict=3D0=0A= caret.policy.slop=3D0=0A= caret.policy.lines=3D0=0A= =0A= visible.policy.strict=3D1=0A= visible.policy.slop=3D1=0A= visible.policy.lines=3D5=0A= =0A= warning.findwrapped=3D0,C:\WINDOWS\MEDIA\Robotz Standard.wav=0A= warning.wrongfile=3D0,C:\WINDOWS\MEDIA\Robotz Fehler.wav=0A= #warning.executeok=3D0,C:\WINDOWS\MEDIA\DING.WAV=0A= warning.executeko=3D0,C:\WINDOWS\MEDIA\Robotz Maximieren.wav=0A= #warning.nootherbookmark=3D0,C:\WINDOWS\MEDIA\DING.WAV=0A= =0A= ################################################################=0A= =0A= # Give symbolic names to the set of fonts used in the standard styles.=0A= if PLAT_WIN=0A= font.base=3Dfont:Verdana,size:10=0A= =0A= font.small=3Dfont:Courier,size:9=0A= font.comment=3Dfont:Comic Sans MS,size:9=0A= font.text=3Dfont:Times New Roman,size:11=0A= font.monospace=3Dfont:Courier New,size:10=0A= font.vbs=3Dfont:Lucida Sans Unicode,size:10=0A= =0A= if PLAT_GTK=0A= font.base=3Dfont:Verdana,size:12=0A= =0A= font.small=3Dfont:Courier New,size:12=0A= font.comment=3Dfont:Comic,size:11=0A= font.text=3Dfont:Times New Roman,size:13=0A= font.monospace=3Dfont:Courier New,size:12=0A= #font.monospace=3Dfont:Fixed,size:14=0A= #font.monospace=3Dfont:Fixed,size:12=0A= font.vbs=3Dfont:Lucida Sans Unicode,size:12=0A= font.js=3D$(font.comment)=0A= =0A= =0A= # Global default styles for all languages=0A= =0A= # Default=0A= style.*.32=3Dback:#e0e0d0,$(font.base)=0A= # Line number=0A= style.*.33=3Dback:#c0c0a8=0A= # Brace highlight=0A= style.*.34=3Dfore:#00aa00,bold=0A= # Brace incomplete highlight=0A= style.*.35=3Dfore:#FF0000,bold=0A= # Control characters=0A= style.*.36=3D=0A= # Indentation Guides=0A= style.*.37=3Dfore:#808070=0A= =0A= ################################################################=0A= =0A= # Python styles=0A= =0A= # White space=0A= style.python.0=3Dfore:#808070=0A= # Comment=0A= style.python.1=3Dfore:#dd0000=0A= #style.python.1=3Dfore:#dd0000,italics=0A= # Number=0A= style.python.2=3Dfore:#007f7f,bold=0A= # String=0A= style.python.3=3Dfore:#007f00=0A= # Single quoted string=0A= style.python.4=3Dfore:#007f00=0A= # Keyword=0A= style.python.5=3Dfore:#ff7700,bold=0A= # Triple quotes=0A= style.python.6=3Dfore:#00aa00=0A= # Triple double quotes=0A= style.python.7=3Dfore:#00aa00=0A= # Class name definition=0A= style.python.8=3Dfore:#0000ff,bold=0A= # Function or method name definition=0A= style.python.9=3Dfore:#7f00aa,bold=0A= # Operators=0A= style.python.10=3Dfore:#7f3f00,bold=0A= # Identifiers=0A= style.python.11=3D=0A= # Comment-blocks=0A= style.python.12=3Dfore:#7F7F7F=0A= # End of line where string is not closed=0A= style.python.13=3Dfore:#000000,font:Courier New,back:#E0C0E0,eolfilled=0A= # Matched Operators=0A= #style.python.34=3Ditalics=0A= #style.python.35=3Ditalics=0A= # Braces are only matched in operator style=0A= braces.python.style=3D10=0A= =0A= #~ font.monospace=3Dfont:FixedSys,size:12 #~ font.base=3D$(font.monospace) #~ font.small=3D$(font.monospace) #~ font.comment=3D$(font.monospace) #~ font.code.comment.box=3D$(font.monospace) #~ font.code.comment.line=3D$(font.monospace) #~ font.code.comment.doc=3D$(font.monospace) #~ font.text=3D$(font.monospace) #~ font.text.comment=3D$(font.monospace) #~ font.embedded.base=3D$(font.monospace) #~ font.embedded.comment=3D$(font.monospace) #~ font.vbs=3D$(font.monospace) ------=_NextPart_000_0011_01C0DB01.E8ABD740-- From gritsch@iue.tuwien.ac.at Sat May 12 15:40:11 2001 From: gritsch@iue.tuwien.ac.at (Markus Gritsch) Date: Sat, 12 May 2001 16:40:11 +0200 Subject: [Edu-sig] SciTE config question on Win32 References: <001f01c0daec$5c7ff2c0$c3090740@megapathdsl.net> Message-ID: <001c01c0daf1$7592c3a0$759322c3@telekabel.at> > I need a jump start... > > SciTE will not run my python scripts yet. > Does not respond to 'F5: Go' > > I opened python.properties > > ... > if PLAT_WIN > command.go.*.py=pythonw -u $(FileNameExt) > command.go.subsystem.*.py=1 > ... > > How should I set this up for running 1.5.2, 2.x etc.. Eiter make python available in your PATH environment varible, or specify the full path to the python executable. This way it is easy to switch between different python installations. Have fun, Markus From sheila@thinkspot.net Sat May 12 19:00:38 2001 From: sheila@thinkspot.net (Sheila King) Date: Sat, 12 May 2001 11:00:38 -0700 Subject: [Edu-sig] graphics programming with Python In-Reply-To: References: Message-ID: <33CF903B45@kserver.org> Hi Danny, I'm trying to use your simple graphics module. The problems that I wrote to you about earlier, were related to installing a new version of IDLE that came with VPython and overwrote my default install that came with Python2.0. I've got that fixed, now. So, I've put your graphics module under Python20/Lib/ and when I try to run your little script below, a Tkinter window comes up, but it is blank, and it stays blank. ??? Help? -- Sheila King http://www.thinkspot.net/sheila/ http://www.k12groups.org/ On Wed, 9 May 2001 03:16:29 -0700 (PDT), Daniel Yoo wrote about [Edu-sig] graphics programming with Python: :Here's a preliminary version of a simplified interface to a Tkinter :canvas. It's simple enough so that the user just needs to type: : :### :from graphics import * : :def drawBox(x1, y1, x2, y2): : """Draws a box where the upper left is (x1, y1), and the : lower right is (x2, y2).""" : positionPen(x1, y1) : drawLineTo(x2, y1) : drawLineTo(x2, y2) : drawLineTo(x1, y2) : drawLineTo(x1, y1) : :drawBox(-100, 100, 100, -100) :### : :to get a box drawn. By default, the Canvas is 400x400, and the user can :send commands like: : : drawLine : drawPoint : setRGBColor : :without having to worry about creating a canvas. Also, it uses normal :rectangular coordinates, so (0, 0) is at the center, (200, 200) is the :upper right corner, and (-200, -200) is the bottom left. : :Please give suggestions on this; I just typed this up yesterday, so it :surely has room for improvement and clarity. : :I hope this is useful! From sheila@thinkspot.net Sat May 12 20:03:18 2001 From: sheila@thinkspot.net (Sheila King) Date: Sat, 12 May 2001 12:03:18 -0700 Subject: [Edu-sig] graphics programming with Python In-Reply-To: <33CF903B45@kserver.org> References: <33CF903B45@kserver.org> Message-ID: <6D345C0062@kserver.org> I take it back. I was trying to put the script into the interactive interpreter in IDLE. That didn't work. When I put it into a saved script file, and ran it from within IDLE, by opening the script in a separate window, then it appeared to work just fine. -- Sheila King http://www.thinkspot.net/sheila/ http://www.k12groups.org/ On Sat, 12 May 2001 11:00:38 -0700, Sheila King wrote about Re: [Edu-sig] graphics programming with Python: :Hi Danny, I'm trying to use your simple graphics module. : :The problems that I wrote to you about earlier, were related to installing a new :version of IDLE that came with VPython and overwrote my default install that :came with Python2.0. I've got that fixed, now. : :So, I've put your graphics module under Python20/Lib/ and when I try to run your :little script below, a Tkinter window comes up, but it is blank, and it stays :blank. : :??? : :Help? From pdx4d@teleport.com Sat May 12 21:23:22 2001 From: pdx4d@teleport.com (Kirby Urner) Date: Sat, 12 May 2001 13:23:22 -0700 Subject: [Edu-sig] graphics programming with Python In-Reply-To: <6D345C0062@kserver.org> Message-ID: <000c01c0db21$649eb420$0802a8c0@KirbyUrner> You can use Daniel's graphics.py in shell mode if you enter the lines sequentially. >>> from graphics import * >>> clearGraphics() >>> drawLine(0, 0, 100, 0) >>> drawLine(100, 0, 100, 100) >>> drawLine(100, 100, 0, 100) >>> drawLine(0, 100, 0, 0) This seems tedius because you'd normally want to do more than draw a single line. >>> import circle >>> circle.testCircles(10,1) is a more realistic example of interactive use. Kirby -----Original Message----- From: edu-sig-admin@python.org [mailto:edu-sig-admin@python.org]On Behalf Of Sheila King Sent: Saturday, May 12, 2001 12:03 PM To: Daniel Yoo; edu-sig@python.org Subject: Re: [Edu-sig] graphics programming with Python I take it back. I was trying to put the script into the interactive interpreter in IDLE. That didn't work. When I put it into a saved script file, and ran it from within IDLE, by opening the script in a separate window, then it appeared to work just fine. From Arthinator@aol.com Sun May 13 05:21:35 2001 From: Arthinator@aol.com (Arthinator@aol.com) Date: Sun, 13 May 2001 00:21:35 EDT Subject: [Edu-sig] IDLE and VPython Message-ID: <14.140ccb5e.282f65cf@aol.com> --part1_14.140ccb5e.282f65cf_boundary Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Noting Sheila's problem discussed on the Python list and here re: VPython installation breaking stuff for her; Noting my concerns related to trying to distribute my PyGeo which has now evolved essentially into a VPython library. Noting my own opinion that VPython will, or at least should, become an almost standard part of a Python installation geared toward educatinal use. Noting that the VPython footprint, except as to its own IDLE version, is extremely small and will co-exist easily with a standard Python installation. Noting that the VPython IDLE fork is falling further behind the Python release version. Agreeing that the interactive IDLE is an essential piece of an installation geared toward educational use. Feeling strongly that a standard Python installation that could accept VPython out of the box would be a boon to Python for educational use. Finally, not understanding what of significance running in its own Process Space brings to the table for standard IDLE, and certainly feeling that other than that single issue the VPython forked IDLE adds nothing essential to VPython's use for educational purposes. Going as far as to wish that a future VPython might become part of the standard Python distribution. Trying to see, encourage something to be worked out here by David and Guido, is to me, core EDU-SIG. ART --part1_14.140ccb5e.282f65cf_boundary Content-Type: text/html; charset="US-ASCII" Content-Transfer-Encoding: 7bit
Noting Sheila's problem discussed on the Python list and here re: VPython
installation breaking stuff for her;

Noting my concerns related to trying to distribute my PyGeo which has now
evolved essentially into a VPython library.

Noting my own opinion that VPython will, or at least should, become an almost
standard part of a Python installation geared toward educatinal use.

Noting that the VPython footprint, except as to its own IDLE version, is
extremely small and will co-exist easily with a standard Python
installation.

Noting that the VPython IDLE fork is falling further behind the Python release
version.

Agreeing that the interactive IDLE is an essential piece of an installation
geared toward educational use.

Feeling strongly that a standard Python installation that could accept VPython
out of the box would be a boon to Python for educational use.

Finally, not understanding what of significance running in its own Process
Space brings to the table for standard IDLE, and certainly feeling that other
than that single issue the VPython forked IDLE adds nothing essential to
VPython's use for educational purposes.

Going as far as to wish that a future VPython might become part of the
standard
Python distribution.

Trying to see, encourage something to be worked out here by David and Guido,
is
to me, core EDU-SIG.

ART
--part1_14.140ccb5e.282f65cf_boundary-- From gritsch@iue.tuwien.ac.at Sun May 13 12:15:54 2001 From: gritsch@iue.tuwien.ac.at (Markus Gritsch) Date: Sun, 13 May 2001 13:15:54 +0200 Subject: [Edu-sig] IDLE and VPython References: <14.140ccb5e.282f65cf@aol.com> Message-ID: <001501c0db9e$13f34680$759322c3@telekabel.at> This is a multi-part message in MIME format. ------=_NextPart_000_0012_01C0DBAE.D7069860 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable From: Arthinator@aol.com=20 Finally, not understanding what of significance running in its own = Process=20 Space brings to the table for standard IDLE, and certainly feeling = that other=20 than that single issue the VPython forked IDLE adds nothing essential = to=20 VPython's use for educational purposes.=20 I think it is easier to step-through a script with a debugger if it is = startet in the same process. Otherwise you had to communicate with the = script via some sockets or something like this. Markus ------=_NextPart_000_0012_01C0DBAE.D7069860 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable From:=20
Arthinator@aol.com

Finally, not = understanding what=20 of significance running in its own Process
Space brings to the = table for=20 standard IDLE, and certainly feeling that other
than that single = issue the=20 VPython forked IDLE adds nothing essential to
VPython's use for=20 educational purposes.
I think it is easier to step-through a = script with a=20 debugger if it is startet in the same process.  Otherwise you = had to=20 communicate with the script via some sockets or something like=20 this.
 
Markus
 
------=_NextPart_000_0012_01C0DBAE.D7069860-- From HotToPot@aol.com Sun May 13 15:38:29 2001 From: HotToPot@aol.com (HotToPot@aol.com) Date: Sun, 13 May 2001 10:38:29 EDT Subject: [Edu-sig] IDLE and VPython Message-ID: Markus writes > >I think it is easier to step-through a script with a debugger if it is = >startet in the same process. Otherwise you had to communicate with the = >script via some sockets or something like this. Efforts are well under way on various fronts to provide the professional Python developer with powerful environments, including advanced debugging. There are and will be continue to be, it seems clear, almost an embarrassment of riches to choose from for the Python pro - the process driven by commercial competition. IDLE was conceived from day one as an introductory IDE for educational purposes. I guess since I have gotten a decent way into Python without having touched a debugger - a strategically placed "print" command usually is sufficient to tell me what I need to know - I would suggest that some marginal loss of performance or features of the IDLE debugger to achieve more "openness"" is well worth it. Though I am saying this not understanding exactly how far those trade-offs might go. And certainly I am not suggesting an IDLE without some decent debugging capabilities. I can in fact understand how the debugger could be used quite effectively in an educational setting, allowing folks to get a sense of what is happening behind the scenes. Probably could have shortened some of my own learning curves significantly had I availed myself of it. And of course my argument ignores the necessary install of Numeric in any case. It has always been the first thing I reach for in doing a Python install, and this from early on. So I guess to me it has become almost a quasi-official part of a standard Python configuration. But it would be great to see something get done here - as they say down on Mulberry Street - "for the kids". ART From HotToPot@aol.com Sun May 13 20:21:50 2001 From: HotToPot@aol.com (HotToPot@aol.com) Date: Sun, 13 May 2001 15:21:50 EDT Subject: [Edu-sig] IDLE and VPython Message-ID: <3d.b9d24fb.283038ce@aol.com> While not seeing much activity on the IDLE fork sourceforge site, further research indicates the BDFL is on the case: http://mail.python.org/pipermail/idle-dev/2000-December/000251.html BTW- sorry for coming at the list as one person from different e-mail addresses. Probably confusing. Home logistics. My wife, among other pursuits, is a potter - which I hope explains her AOL log-on. ART From sheila@thinkspot.net Mon May 14 02:38:36 2001 From: sheila@thinkspot.net (Sheila King) Date: Sun, 13 May 2001 18:38:36 -0700 Subject: [Edu-sig] IDLE and VPython In-Reply-To: <14.140ccb5e.282f65cf@aol.com> References: <14.140ccb5e.282f65cf@aol.com> Message-ID: <1AAB2CD27F0@kserver.org> On Sun, 13 May 2001 00:21:35 EDT, Arthinator@aol.com wrote about [Edu-sig] IDLE and VPython: :Noting Sheila's problem discussed on the Python list and here re: VPython :installation breaking stuff for her; Yes, I'm going to show it to my students on Monday. If any are interested, I will install it for them, but I don't relish having to re-install the Python 2.0 IDLE again, afterwards. :Finally, not understanding what of significance running in its own Process :Space brings to the table for standard IDLE, and certainly feeling that other :than that single issue the VPython forked IDLE adds nothing essential to :VPython's use for educational purposes. When I run a script using Tkinter or VPython in IDLE 0.6, and then exit the script, my IDLE session ends also. This doesn't happen with the version of IDLE that comes with VPython. Also, rather than having the output of my script come up in the interactive shell, VPython's IDLE sends the output to a separate window. -- Sheila King http://www.thinkspot.net/sheila/ http://www.k12groups.org/ From jasonic@nomadicsltd.com Tue May 15 19:00:33 2001 From: jasonic@nomadicsltd.com (Jason Cunliffe) Date: Tue, 15 May 2001 14:00:33 -0400 Subject: [Edu-sig] The Register - interview with Monte Davidoff Message-ID: <000801c0dd68$f09afbc0$c3090740@megapathdsl.net> This is a multi-part message in MIME format. ------=_NextPart_000_0005_01C0DD47.6885F580 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Microsoft Altair BASIC legend talks about Linux, CPRM and that very frightening photo http://www.theregister.co.uk/content/4/18909.html His other passion, he tells us, is Python. "Hats off to them. It's an extremely well designed language. It's object orientated from the get-go. They've really succeeded there," he says, and commends it as the ideal teaching language. That used to be BASIC, of course. ------=_NextPart_000_0005_01C0DD47.6885F580 Content-Type: application/octet-stream; name="The Register.url" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="The Register.url" [DEFAULT] BASEURL=http://www.theregister.co.uk/content/4/18909.html [InternetShortcut] URL=http://www.theregister.co.uk/content/4/18909.html Modified=400CC4A568DDC001BB ------=_NextPart_000_0005_01C0DD47.6885F580-- From pdx4d@teleport.com Fri May 18 01:21:26 2001 From: pdx4d@teleport.com (Kirby Urner) Date: Thu, 17 May 2001 17:21:26 -0700 Subject: [Edu-sig] Standard Math 2001 In-Reply-To: <000801c0dd68$f09afbc0$c3090740@megapathdsl.net> Message-ID: <000601c0df30$7aa17600$0802a8c0@KirbyUrner> >>> def pascal(n): """ Simple loop for printing rows 1-n of Pascal's Triangle """ row = [1] for j in range(n): print row row = [1] \ + [row[i] + row[i+1] for i in range(len(row)-1)] + \ [1] >>> pascal(10) [1] [1, 1] [1, 2, 1] [1, 3, 3, 1] [1, 4, 6, 4, 1] [1, 5, 10, 10, 5, 1] [1, 6, 15, 20, 15, 6, 1] [1, 7, 21, 35, 35, 21, 7, 1] [1, 8, 28, 56, 70, 56, 28, 8, 1] [1, 9, 36, 84, 126, 126, 84, 36, 9, 1] Comparing Polynomial w/ Pascal's Triangle: >>> from mathobjects import * >>> term = Poly([1,1],'t') >>> term t + 1 >>> term**9 t**9 + 9*t**8 + 36*t**7 + 84*t**6 + 126*t**5 + 126*t**4 + 84*t**3 + 36*t**2 + 9*t + 1 See: Binomial Theorem http://www.inetarena.com/~pdx4d/ocn/binomial.html From dorothea@impressions.com Fri May 18 17:03:48 2001 From: dorothea@impressions.com (dorothea@impressions.com) Date: 18 May 2001 11:03:48 -0500 Subject: [Edu-sig] Auto Reply to your message ... Message-ID: <3AF5D39B00002088@impmail.impinet.com> This is a MIME-encapsulated message --=========3AF5D39B00002088/impmail.impinet.com ----- The following text is an automated response to your message ----- Dorothea Salo is no longer at Impressions Book & Journal Services. So that we may respond to your e-mail, it has been forwarded to Vicki Sullivan. ----- Original message follows ----- --=========3AF5D39B00002088/impmail.impinet.com Content-Type: Message/RFC822 Return-Path: Received: from mara.eti.org (152.160.154.2) by impmail.impinet.com (Worldmail 1.3.167) for dorothea@impressions.com; 18 May 2001 11:03:48 -0500 Received: from mail.python.org (mail.python.org [63.102.49.29]) by mara.eti.org (8.9.3/8.9.3) with ESMTP id MAA00548 for ; Fri, 18 May 2001 12:13:47 -0400 Received: from localhost.localdomain ([127.0.0.1] helo=mail.python.org) by mail.python.org with esmtp (Exim 3.21 #1) id 150mi1-0006yP-00; Fri, 18 May 2001 12:02:33 -0400 From: edu-sig-request@python.org Subject: Edu-sig digest, Vol 1 #297 - 1 msg Reply-to: edu-sig@python.org X-Mailer: Mailman v2.0.5 (101270) MIME-version: 1.0 Content-type: text/plain To: edu-sig@python.org Sender: edu-sig-admin@python.org Errors-To: edu-sig-admin@python.org X-BeenThere: edu-sig@python.org X-Mailman-Version: 2.0.5 (101270) Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Python in education List-Unsubscribe: , List-Archive: Message-Id: Date: Fri, 18 May 2001 12:02:33 -0400 Send Edu-sig mailing list submissions to edu-sig@python.org To subscribe or unsubscribe via the World Wide Web, visit http://mail.python.org/mailman/listinfo/edu-sig or, via email, send a message with subject or body 'help' to edu-sig-request@python.org You can reach the person managing the list at edu-sig-admin@python.org When replying, please edit your Subject line so it is more specific than "Re: Contents of Edu-sig digest..." Today's Topics: 1. Standard Math 2001 (Kirby Urner) --__--__-- Message: 1 Reply-To: From: "Kirby Urner" To: Date: Thu, 17 May 2001 17:21:26 -0700 Subject: [Edu-sig] Standard Math 2001 >>> def pascal(n): """ Simple loop for printing rows 1-n of Pascal's Triangle """ row = [1] for j in range(n): print row row = [1] \ + [row[i] + row[i+1] for i in range(len(row)-1)] + \ [1] >>> pascal(10) [1] [1, 1] [1, 2, 1] [1, 3, 3, 1] [1, 4, 6, 4, 1] [1, 5, 10, 10, 5, 1] [1, 6, 15, 20, 15, 6, 1] [1, 7, 21, 35, 35, 21, 7, 1] [1, 8, 28, 56, 70, 56, 28, 8, 1] [1, 9, 36, 84, 126, 126, 84, 36, 9, 1] Comparing Polynomial w/ Pascal's Triangle: >>> from mathobjects import * >>> term = Poly([1,1],'t') >>> term t + 1 >>> term**9 t**9 + 9*t**8 + 36*t**7 + 84*t**6 + 126*t**5 + 126*t**4 + 84*t**3 + 36*t**2 + 9*t + 1 See: Binomial Theorem http://www.inetarena.com/~pdx4d/ocn/binomial.html --__--__-- _______________________________________________ Edu-sig mailing list Edu-sig@python.org http://mail.python.org/mailman/listinfo/edu-sig End of Edu-sig Digest --=========3AF5D39B00002088/impmail.impinet.com-- From dorothea@impressions.com Sun May 20 12:24:21 2001 From: dorothea@impressions.com (dorothea@impressions.com) Date: 20 May 2001 06:24:21 -0500 Subject: [Edu-sig] Auto Reply to your message ... Message-ID: <3AF5D39B00002291@impmail.impinet.com> This is a MIME-encapsulated message --=========3AF5D39B00002291/impmail.impinet.com ----- The following text is an automated response to your message ----- Dorothea Salo is no longer at Impressions Book & Journal Services. So that we may respond to your e-mail, it has been forwarded to Vicki Sullivan. ----- Original message follows ----- --=========3AF5D39B00002291/impmail.impinet.com Content-Type: Message/RFC822 Return-Path: Received: from mara.eti.org (152.160.154.2) by impmail.impinet.com (Worldmail 1.3.167) for dorothea@impressions.com; 20 May 2001 06:24:21 -0500 Received: from mail.python.org (mail.python.org [63.102.49.29]) by mara.eti.org (8.9.3/8.9.3) with ESMTP id OAA03649 for ; Sat, 19 May 2001 14:02:45 -0400 Received: from localhost.localdomain ([127.0.0.1] helo=mail.python.org) by mail.python.org with esmtp (Exim 3.21 #1) id 1519A8-0003bS-00; Sat, 19 May 2001 12:01:04 -0400 From: edu-sig-request@python.org Subject: Edu-sig digest, Vol 1 #298 - 1 msg Reply-to: edu-sig@python.org X-Mailer: Mailman v2.0.5 (101270) MIME-version: 1.0 Content-type: text/plain To: edu-sig@python.org Sender: edu-sig-admin@python.org Errors-To: edu-sig-admin@python.org X-BeenThere: edu-sig@python.org X-Mailman-Version: 2.0.5 (101270) Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Python in education List-Unsubscribe: , List-Archive: Message-Id: Date: Sat, 19 May 2001 12:01:04 -0400 Send Edu-sig mailing list submissions to edu-sig@python.org To subscribe or unsubscribe via the World Wide Web, visit http://mail.python.org/mailman/listinfo/edu-sig or, via email, send a message with subject or body 'help' to edu-sig-request@python.org You can reach the person managing the list at edu-sig-admin@python.org When replying, please edit your Subject line so it is more specific than "Re: Contents of Edu-sig digest..." Today's Topics: 1. Auto Reply to your message ... (dorothea@impressions.com) --__--__-- Message: 1 From: dorothea@impressions.com To: edu-sig@python.org Date: 18 May 2001 11:03:48 -0500 Subject: [Edu-sig] Auto Reply to your message ... This is a MIME-encapsulated message --=========3AF5D39B00002088/impmail.impinet.com ----- The following text is an automated response to your message ----- Dorothea Salo is no longer at Impressions Book & Journal Services. So that we may respond to your e-mail, it has been forwarded to Vicki Sullivan. ----- Original message follows ----- --=========3AF5D39B00002088/impmail.impinet.com Content-Type: Message/RFC822 Return-Path: Received: from mara.eti.org (152.160.154.2) by impmail.impinet.com (Worldmail 1.3.167) for dorothea@impressions.com; 18 May 2001 11:03:48 -0500 Received: from mail.python.org (mail.python.org [63.102.49.29]) by mara.eti.org (8.9.3/8.9.3) with ESMTP id MAA00548 for ; Fri, 18 May 2001 12:13:47 -0400 Received: from localhost.localdomain ([127.0.0.1] helo=mail.python.org) by mail.python.org with esmtp (Exim 3.21 #1) id 150mi1-0006yP-00; Fri, 18 May 2001 12:02:33 -0400 From: edu-sig-request@python.org Subject: Edu-sig digest, Vol 1 #297 - 1 msg Reply-to: edu-sig@python.org X-Mailer: Mailman v2.0.5 (101270) MIME-version: 1.0 Content-type: text/plain To: edu-sig@python.org Sender: edu-sig-admin@python.org Errors-To: edu-sig-admin@python.org X-BeenThere: edu-sig@python.org X-Mailman-Version: 2.0.5 (101270) Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Python in education List-Unsubscribe: , List-Archive: Message-Id: Date: Fri, 18 May 2001 12:02:33 -0400 Send Edu-sig mailing list submissions to edu-sig@python.org To subscribe or unsubscribe via the World Wide Web, visit http://mail.python.org/mailman/listinfo/edu-sig or, via email, send a message with subject or body 'help' to edu-sig-request@python.org You can reach the person managing the list at edu-sig-admin@python.org When replying, please edit your Subject line so it is more specific than "Re: Contents of Edu-sig digest..." Today's Topics: 1. Standard Math 2001 (Kirby Urner) -- __--__-- Message: 1 Reply-To: From: "Kirby Urner" To: Date: Thu, 17 May 2001 17:21:26 -0700 Subject: [Edu-sig] Standard Math 2001 >>> def pascal(n): """ Simple loop for printing rows 1-n of Pascal's Triangle """ row = [1] for j in range(n): print row row = [1] \ + [row[i] + row[i+1] for i in range(len(row)-1)] + \ [1] >>> pascal(10) [1] [1, 1] [1, 2, 1] [1, 3, 3, 1] [1, 4, 6, 4, 1] [1, 5, 10, 10, 5, 1] [1, 6, 15, 20, 15, 6, 1] [1, 7, 21, 35, 35, 21, 7, 1] [1, 8, 28, 56, 70, 56, 28, 8, 1] [1, 9, 36, 84, 126, 126, 84, 36, 9, 1] Comparing Polynomial w/ Pascal's Triangle: >>> from mathobjects import * >>> term = Poly([1,1],'t') >>> term t + 1 >>> term**9 t**9 + 9*t**8 + 36*t**7 + 84*t**6 + 126*t**5 + 126*t**4 + 84*t**3 + 36*t**2 + 9*t + 1 See: Binomial Theorem http://www.inetarena.com/~pdx4d/ocn/binomial.html -- __--__-- _______________________________________________ Edu-sig mailing list Edu-sig@python.org http://mail.python.org/mailman/listinfo/edu-sig End of Edu-sig Digest --=========3AF5D39B00002088/impmail.impinet.com-- --__--__-- _______________________________________________ Edu-sig mailing list Edu-sig@python.org http://mail.python.org/mailman/listinfo/edu-sig End of Edu-sig Digest --=========3AF5D39B00002291/impmail.impinet.com-- From dorothea@impressions.com Sun May 20 17:01:19 2001 From: dorothea@impressions.com (dorothea@impressions.com) Date: 20 May 2001 11:01:19 -0500 Subject: [Edu-sig] Auto Reply to your message ... Message-ID: <3AF5D39B000022AE@impmail.impinet.com> This is a MIME-encapsulated message --=========3AF5D39B000022AE/impmail.impinet.com ----- The following text is an automated response to your message ----- Dorothea Salo is no longer at Impressions Book & Journal Services. So that we may respond to your e-mail, it has been forwarded to Vicki Sullivan. ----- Original message follows ----- --=========3AF5D39B000022AE/impmail.impinet.com Content-Type: Message/RFC822 Return-Path: Received: from mara.eti.org (152.160.154.2) by impmail.impinet.com (Worldmail 1.3.167) for dorothea@impressions.com; 20 May 2001 11:01:19 -0500 Received: from mail.python.org (mail.python.org [63.102.49.29]) by mara.eti.org (8.9.3/8.9.3) with ESMTP id MAA05093 for ; Sun, 20 May 2001 12:11:24 -0400 Received: from localhost.localdomain ([127.0.0.1] helo=mail.python.org) by mail.python.org with esmtp (Exim 3.21 #1) id 151Vdg-0006t8-00; Sun, 20 May 2001 12:01:04 -0400 From: edu-sig-request@python.org Subject: Edu-sig digest, Vol 1 #299 - 1 msg Reply-to: edu-sig@python.org X-Mailer: Mailman v2.0.5 (101270) MIME-version: 1.0 Content-type: text/plain To: edu-sig@python.org Sender: edu-sig-admin@python.org Errors-To: edu-sig-admin@python.org X-BeenThere: edu-sig@python.org X-Mailman-Version: 2.0.5 (101270) Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Python in education List-Unsubscribe: , List-Archive: Message-Id: Date: Sun, 20 May 2001 12:01:04 -0400 Send Edu-sig mailing list submissions to edu-sig@python.org To subscribe or unsubscribe via the World Wide Web, visit http://mail.python.org/mailman/listinfo/edu-sig or, via email, send a message with subject or body 'help' to edu-sig-request@python.org You can reach the person managing the list at edu-sig-admin@python.org When replying, please edit your Subject line so it is more specific than "Re: Contents of Edu-sig digest..." Today's Topics: 1. Auto Reply to your message ... (dorothea@impressions.com) --__--__-- Message: 1 From: dorothea@impressions.com To: edu-sig@python.org Date: 20 May 2001 06:24:21 -0500 Subject: [Edu-sig] Auto Reply to your message ... This is a MIME-encapsulated message --=========3AF5D39B00002291/impmail.impinet.com ----- The following text is an automated response to your message ----- Dorothea Salo is no longer at Impressions Book & Journal Services. So that we may respond to your e-mail, it has been forwarded to Vicki Sullivan. ----- Original message follows ----- --=========3AF5D39B00002291/impmail.impinet.com Content-Type: Message/RFC822 Return-Path: Received: from mara.eti.org (152.160.154.2) by impmail.impinet.com (Worldmail 1.3.167) for dorothea@impressions.com; 20 May 2001 06:24:21 -0500 Received: from mail.python.org (mail.python.org [63.102.49.29]) by mara.eti.org (8.9.3/8.9.3) with ESMTP id OAA03649 for ; Sat, 19 May 2001 14:02:45 -0400 Received: from localhost.localdomain ([127.0.0.1] helo=mail.python.org) by mail.python.org with esmtp (Exim 3.21 #1) id 1519A8-0003bS-00; Sat, 19 May 2001 12:01:04 -0400 From: edu-sig-request@python.org Subject: Edu-sig digest, Vol 1 #298 - 1 msg Reply-to: edu-sig@python.org X-Mailer: Mailman v2.0.5 (101270) MIME-version: 1.0 Content-type: text/plain To: edu-sig@python.org Sender: edu-sig-admin@python.org Errors-To: edu-sig-admin@python.org X-BeenThere: edu-sig@python.org X-Mailman-Version: 2.0.5 (101270) Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Python in education List-Unsubscribe: , List-Archive: Message-Id: Date: Sat, 19 May 2001 12:01:04 -0400 Send Edu-sig mailing list submissions to edu-sig@python.org To subscribe or unsubscribe via the World Wide Web, visit http://mail.python.org/mailman/listinfo/edu-sig or, via email, send a message with subject or body 'help' to edu-sig-request@python.org You can reach the person managing the list at edu-sig-admin@python.org When replying, please edit your Subject line so it is more specific than "Re: Contents of Edu-sig digest..." Today's Topics: 1. Auto Reply to your message ... (dorothea@impressions.com) -- __--__-- Message: 1 From: dorothea@impressions.com To: edu-sig@python.org Date: 18 May 2001 11:03:48 -0500 Subject: [Edu-sig] Auto Reply to your message ... This is a MIME-encapsulated message --=========3AF5D39B00002088/impmail.impinet.com ----- The following text is an automated response to your message ----- Dorothea Salo is no longer at Impressions Book & Journal Services. So that we may respond to your e-mail, it has been forwarded to Vicki Sullivan. ----- Original message follows ----- --=========3AF5D39B00002088/impmail.impinet.com Content-Type: Message/RFC822 Return-Path: Received: from mara.eti.org (152.160.154.2) by impmail.impinet.com (Worldmail 1.3.167) for dorothea@impressions.com; 18 May 2001 11:03:48 -0500 Received: from mail.python.org (mail.python.org [63.102.49.29]) by mara.eti.org (8.9.3/8.9.3) with ESMTP id MAA00548 for ; Fri, 18 May 2001 12:13:47 -0400 Received: from localhost.localdomain ([127.0.0.1] helo=mail.python.org) by mail.python.org with esmtp (Exim 3.21 #1) id 150mi1-0006yP-00; Fri, 18 May 2001 12:02:33 -0400 From: edu-sig-request@python.org Subject: Edu-sig digest, Vol 1 #297 - 1 msg Reply-to: edu-sig@python.org X-Mailer: Mailman v2.0.5 (101270) MIME-version: 1.0 Content-type: text/plain To: edu-sig@python.org Sender: edu-sig-admin@python.org Errors-To: edu-sig-admin@python.org X-BeenThere: edu-sig@python.org X-Mailman-Version: 2.0.5 (101270) Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Python in education List-Unsubscribe: , List-Archive: Message-Id: Date: Fri, 18 May 2001 12:02:33 -0400 Send Edu-sig mailing list submissions to edu-sig@python.org To subscribe or unsubscribe via the World Wide Web, visit http://mail.python.org/mailman/listinfo/edu-sig or, via email, send a message with subject or body 'help' to edu-sig-request@python.org You can reach the person managing the list at edu-sig-admin@python.org When replying, please edit your Subject line so it is more specific than "Re: Contents of Edu-sig digest..." Today's Topics: 1. Standard Math 2001 (Kirby Urner) -- __--__-- Message: 1 Reply-To: From: "Kirby Urner" To: Date: Thu, 17 May 2001 17:21:26 -0700 Subject: [Edu-sig] Standard Math 2001 >>> def pascal(n): """ Simple loop for printing rows 1-n of Pascal's Triangle """ row = [1] for j in range(n): print row row = [1] \ + [row[i] + row[i+1] for i in range(len(row)-1)] + \ [1] >>> pascal(10) [1] [1, 1] [1, 2, 1] [1, 3, 3, 1] [1, 4, 6, 4, 1] [1, 5, 10, 10, 5, 1] [1, 6, 15, 20, 15, 6, 1] [1, 7, 21, 35, 35, 21, 7, 1] [1, 8, 28, 56, 70, 56, 28, 8, 1] [1, 9, 36, 84, 126, 126, 84, 36, 9, 1] Comparing Polynomial w/ Pascal's Triangle: >>> from mathobjects import * >>> term = Poly([1,1],'t') >>> term t + 1 >>> term**9 t**9 + 9*t**8 + 36*t**7 + 84*t**6 + 126*t**5 + 126*t**4 + 84*t**3 + 36*t**2 + 9*t + 1 See: Binomial Theorem http://www.inetarena.com/~pdx4d/ocn/binomial.html -- __--__-- _______________________________________________ Edu-sig mailing list Edu-sig@python.org http://mail.python.org/mailman/listinfo/edu-sig End of Edu-sig Digest --=========3AF5D39B00002088/impmail.impinet.com-- -- __--__-- _______________________________________________ Edu-sig mailing list Edu-sig@python.org http://mail.python.org/mailman/listinfo/edu-sig End of Edu-sig Digest --=========3AF5D39B00002291/impmail.impinet.com-- --__--__-- _______________________________________________ Edu-sig mailing list Edu-sig@python.org http://mail.python.org/mailman/listinfo/edu-sig End of Edu-sig Digest --=========3AF5D39B000022AE/impmail.impinet.com-- From wilson@visi.com Sun May 20 21:01:39 2001 From: wilson@visi.com (Timothy Wilson) Date: Sun, 20 May 2001 15:01:39 -0500 (CDT) Subject: [Edu-sig] Python teaching syllabi Message-ID: Hi everyone, Summer is almost here which means that the start of school next fall isn't far behind. As I've mentioned previously on the list, I'll be teaching two sections of a new "Introduction to Computer Programming" course featuring Python. I'm new to teaching C.S. and I'm wondering if anyone has any syllabi or other similar general course information they could share? (If any C.S. teachers find themselves teaching physics or chemistry I'd be happy to return the favor :-) -Tim -- Tim Wilson | Visit Sibley online: | Check out: Henry Sibley HS | http://www.isd197.org | http://www.zope.org W. St. Paul, MN | | http://slashdot.org wilson@visi.com | | http://linux.com From dave@se.linux.org Sun May 20 22:28:24 2001 From: dave@se.linux.org (David Pettersson) Date: Sun, 20 May 2001 23:28:24 +0200 Subject: [Edu-sig] Python teaching syllabi In-Reply-To: ; from wilson@visi.com on Sun, May 20, 2001 at 03:01:39PM -0500 References: Message-ID: <20010520232823.A5559@se.linux.org> On Sun, May 20, 2001 at 03:01:39PM -0500, Timothy Wilson wrote: > I'm new to teaching C.S. and I'm wondering if anyone has any syllabi > or other similar general course information they could share? The book "Programming Principles in Java" actually teaches OOP by forcing students to adapt to the Model-View-Control paradigm and structural recursion. It was used successfully in the CS 101 course given at my department (I was one of the TA's) this semester. It might still not be published (we used an online version) -- surf the net and you'll find it lying around :-). Sincerely, -- David Pettersson GnuPG public key available From pdx4d@teleport.com Mon May 21 07:29:41 2001 From: pdx4d@teleport.com (Kirby Urner) Date: Sun, 20 May 2001 23:29:41 -0700 Subject: [Edu-sig] Bernoulli Numbers In-Reply-To: <000601c0df30$7aa17600$0802a8c0@KirbyUrner> Message-ID: <002101c0e1bf$6bb4fb80$0802a8c0@KirbyUrner> An algorithm for defining and deriving the Bernoulli numbers involves starting with Pascal's Triangle for (b-1)^n and writing a series of equations, each of which defines the next Bernoulli number in the sequence, using all those that have come before. b[2] = b[2] - 2*b[1] + 1 b[3] = b[3] - 3*b[2] + 3*b[1] - 1 b[4] = b[4] - 4*b[3] + 6*b[2] - 4*b[1] + 1 These may be re-expressed as follows: >>> from bernoulli import * >>> bernseries(7,1) b[1] = (1/2.) * 1 b[2] = (1/3.) * (3*b[1]- 1) b[3] = (1/4.) * (6*b[2] - 4*b[1]+ 1) b[4] = (1/5.) * (10*b[3] - 10*b[2] + 5*b[1]- 1) b[5] = (1/6.) * (15*b[4] - 20*b[3] + 15*b[2] - 6*b[1]+ 1) b[6] = (1/7.) * (21*b[5] - 35*b[4] + 35*b[3] - 21*b[2] + 7*b[1]- 1) b[7] = (1/8.) * (28*b[6] - 56*b[5] + 70*b[4] - 56*b[3] + 28*b[2] - 8*b[1]+ 1) [1, (1/2.), (1/6.), 0, (-1/30.), 0, (1/42.), 0] The last line gives a growing list of Bernoulli numbers, starting with B[0]=1, B[1]=1/2. Notice that all subsequent odd Bernoullis are 0. We can use another function to call the above, but just slice off the last member of the list to get the nth Bernoulli number, which will be rational, a fraction: >>> bernoulli(12) (-691/2730.) >>> bernoulli(14) (7/6.) >>> bernoulli(16) (-3617/510.) >>> bernoulli(20) (-174611/330.) You can check these with Mathematica, which has the Bernoullis built in. The above expressions were developed using regular polynomial multiplication. In other words, we learn in algebra that (b+1)*(b+1) = b**2 + 2*b + 1 and that (b-1)*(b-1) = b**2 - 2*b + 1. Then you can keep multiplying the latter product by (b-1), getting polynomials of successively higher degree, and coefficients that match those in the nth row of Pascal's Triangle (see my previous post re Pascal's Triangle). >>> p = Poly([1,-1],'b') >>> p b - 1 >>> p*p b**2 - 2*b + 1 >>> p*p*p b**3 - 3*b**2 + 3*b - 1 >>> p*p*p*p b**4 - 4*b**3 + 6*b**2 - 4*b + 1 The algorithm for generating the Bernoullis involves changing exponents to subscripts, i.e. b**6 or b**5 gets rewritten as b[6] or b[5] respectively, with b by itself becoming b[1]. So for example, starting with: (b-1)**7 = b**7 - 7*b**6 + 21*b**5 - 35*b**4 + 35*b**3 - 21*b**2 + 7*b - 1 we want that to convert this to something more like: b[7] = b[7] - 7*b[6] + 21*b[5] - 35*b[4] + 35*b[3] - 21*b[2] + 7*b[1]- 1 which further simplifies to the expression written below: b[6] = (1/7.) * (21*b[5] - 35*b[4] + 35*b[3] - 21*b[2] + 7*b[1]- 1) Consider again: b[2] = b[2] - 2*b[1] + 1*b[0] b[3] = b[3] - 3*b[2] + 3*b[1] - 1*b[0] b[4] = b[4] - 4*b[3] + 6*b[2] - 4*b[1] + 1*b[0] Taking the last equality, you see the b[4] terms cancel, and we can bring 4*b[3] onto the left side, then divide by 4: 4*b[3] = 6*b[2] - 4*b[1] + 1*b[0] b[3] = (1/4.) * (6*b[2] - 4*b[1] + 1*b[0]) Regular expressions proved useful for accomplishing this transformation of exponents into subscripts e.g. consider the code below: pat1 = re.compile('\*\*[0-9]*') # find exponents: **n pat2 = re.compile('b ') # find b (no exponent) def mksub(match): return "["+''.join(list(match.group())[2:])+"]" def bernseries(n,show=0): """ Extend Bernoulli series using successive powers of (B-1)^n, with exponents demoted to subscripts """ b = [1] # b[0]=1 poly,term = Poly([1,-1]),Poly([1,-1]) for i in range(n): poly *= term # get polynomial of next higher degree bpoly = Poly(poly.coeffs[2:],'b') bexpr = re.sub(pat1,mksub,str(bpoly)) # b**3 -> b[3] bexpr = re.sub(pat2,"b[1]",bexpr) # b -> b[1] if show: print ("b["+str(i+1)+"] = " + str(Fraction(1,-poly.coeffs[1])) + " * (" + bexpr)+")" b.append(Fraction(eval(bexpr),-poly.coeffs[1])) return b In searching a string like '10*b**3 - 10*b**2 + 5*b- 1' with regular expression '\*\*[0-9]*', we're looking for all occurances of ** followed by one or more digits, i.e. the exponent. The \*\* escapes the double asterisk, to mean the literal '**', whereas the unescaped asterisk following [0-9] says the pattern of digits 0 thru 9 may repeat until it doesn't i.e. until whitespace is encountered. So in '10*b**3 - 10*b**2 + 5*b- 1' we first find '**3', and what we do next is give re.sub the name of a function for dealing with our located string. How the substitution gets carried out depends on this function, which automatically gets, as its only argument, the match object returned when the pattern is found. match.group() will disclose what exactly was found, and we need that information, because we want to throw away the asterisks, but *keep the digits*. "["+''.join(list(match.group())[2:])+"]" is what does the job: stick square brackets at the start and end, and slice off the stars (asterisks) in the middle. What gets returned is [3] instead of **3, or [23] instead of **23 or [444] in place of **444 etc. And re.sub does this work for the whole length of the string, so after pat1 is through, we're left with: '10*b[3] - 10*b[2] + 5*b- 1' It's that final b that we want to deal with next, and pat2 does this. Find 'b ' and replace it with 'b[1]' -- very simple. Each time through the loop, we multiply our polynomial by (x-1), bumping it up another degree. Then we skip the first two coefficients and build a 2nd polynomial in terms of b, run the regular expression substitions and then actually evaluate the result as a fraction, in order to secure the next Bernoulli number for our list (which list we consult at each pass, as every Bernoulli is based on those that have come before). I'm not claiming this is the best or fastest way to get the Bernoullis. It just so happens that we have a polynomial object, so successive multiplications by (x-1) is easily done. More usually, the binomial theorem is used to generate the coefficients directly, using n!/k!(n-k)!, where n is the degree of the polynomial, and k the term. Here, we get those coefficents from the polynomial objects. So we're looking at mathematical relationships, using some open source math objects already at our disposal, plus finding an opportunity to use regular expressions in a not-too-complicated, introductory, yet math-relevant way. What good are Bernoulli numbers? Well, according to 'The Book of Numbers' by Conway and Guy, it was actually a dude named Johann Faulhaber, writing in 1631, who came up with the most familiar way in which the so-called Bernoulli numbers are used: to generate a polynomial giving the sum of the first n consecutive integers all raised to the kth power. You get a polynomial of degree k+1. In other words, suppose I want an expression for 1**10 + 2**10 + 3**10 + 4**10... + n**10, what would I write? My bernoulli.py module will give the answer if you just invoke summa(): def choice(n,k): return reduce(mul, [1L]+range(n,n-k,-1))/reduce(mul,[1L]+range(2,k+1)) def summa(t): terms = [] b = bernseries(t+1) for k in range(t+1): terms.append(Fraction(b[k]*choice(t+1,k),t+1)) return Poly(terms+[0]) [choice(n,k) is just n!/k!(n-k)! and figures into the coefficients, along with the Bernoulli numbers, as per the above summa code]: >>> summa(10) (1/11.)*x**11 + (1/2.)*x**10 + (5/6.)*x**9 - x**7 + x**5 - (1/2.)*x**3 + (5/66.)*x The above polynomial will evaluate the the sum of the first x numbers to the 10th power. OK, so if I substitute 3 for x, I'll know the sum of 1**10 + 2**10 + 3**10. Let's do that at the command line first: >>> 1**10 + 2**10 + 3**10 60074 OK, now since summa() returns a Polynomial object, and I can evaluate those simply be passing a value for x: >>> p10 = summa(10) >>> p10(3) 60074 How about the sum of the 10th powers of consecutive integers up to 1000 (inclusive). Conway and Guy give the answer on pg. 108 of 'The Book of Numbers'. Let's see if our matches: >>> p10(1000L) 91409924241424243424241924242500 That's it! Kirby Source code: http://www.inetarena.com/~pdx4d/ocn/python/bernoulli.py http://www.inetarena.com/~pdx4d/ocn/python/mathobjects.zip mathobjects contains pyfraction, polynomial and simplematrix, all of which have source code in ocn/python (as well as HTML versions), but which are designed to operate in a subdirectory named mathobjects with the included __init__.py i.e. as a package. From pdx4d@teleport.com Tue May 22 03:36:06 2001 From: pdx4d@teleport.com (Kirby Urner) Date: Mon, 21 May 2001 19:36:06 -0700 Subject: [Edu-sig] re: Mathobjects Message-ID: <000e01c0e267$f5dd3e00$0802a8c0@KirbyUrner> Also, I meant to thank Daniel Ajoy in the simplematrix source for a sweet little recursive algorithm (which he shared in Logo) for generating all those permutations needed by that greedy determinants algorithm. I'm adding that thank you now and re-uploading. Finally, I never managed to completely solve the devils' embrace problem of importing pyfraction in polynomial, and polynomial in pyfraction. Importing works when I just import, but I want to promote pyfraction.Fraction to the top level in polynomial, so I don't have to write pyfraction.Fraction all the time (especially inconvenient when expanding polynomials with factional coefficients just for evaluation purposes -- a way to stay with integer computations and avoid degenerating to floating points).... That's why you'll see an 'import Fraction from pyfraction', but in the __call__ method of polynomial, and not up top, where it causes problems when I boot Python initially and go 'from mathobjects import *' -- and even if I have an import pyfraction statement first. Any pointers would be appreciated. I think I must be missing something. Kirby From gritsch@iue.tuwien.ac.at Tue May 22 21:12:42 2001 From: gritsch@iue.tuwien.ac.at (Markus Gritsch) Date: Tue, 22 May 2001 22:12:42 +0200 Subject: [Edu-sig] updated KineticsKit Message-ID: <000b01c0e2fb$9418dd20$759322c3@telekabel.at> Hi! I'd like to mention that I have made some updates to my small package for VPython. You can take a look at it here: http://stud4.tuwien.ac.at/~e9326522/KineticsKit/html/ The package has 3 new examples, improved graphics on the website produced with the export to POV-Ray feature available from the System-class, a class-reference which was generated with the pydoc tool and some other improvements. Enjoy, Markus From morrison@physics.niu.edu Tue May 22 22:35:21 2001 From: morrison@physics.niu.edu (Andrew Morrison) Date: Tue, 22 May 2001 16:35:21 -0500 (CDT) Subject: [Edu-sig] Re: [Visualpython-users] updated KineticsKit In-Reply-To: <000b01c0e2fb$9418dd20$759322c3@telekabel.at> Message-ID: Forgive my ignorance, please (I am only beginning to understand Python) but I am having trouble installing your package. On my linux system I unzipped everything into /usr/local/lib/python2.0/site-packages and a KineticsKit/ directory was created where everything was put. When I try out your examples I get some errors that look like this: [morris@domra examples]$ python2.0 exa04_the_cube.py Traceback (innermost last): File "exa04_the_cube.py", line 1, in ? from KineticsKit import * File "/usr/lib/python1.5/site-packages/KineticsKit/__init__.py", line 12, in ? from system import System File "/usr/lib/python1.5/site-packages/KineticsKit/system.py", line 20 self.display = visual.display(title=name, **keywords) ^ SyntaxError: invalid syntax I don't know much about python2.0, since I have been learning using 1.5, so maybe that is most of my problem. Although, I do know that VPython is working with 2.0... Thanks for the help! Andrew Morrison On Tue, 22 May 2001, Markus Gritsch wrote: > Hi! > > I'd like to mention that I have made some updates to my small package for > VPython. You can take a look at it here: > http://stud4.tuwien.ac.at/~e9326522/KineticsKit/html/ > > The package has 3 new examples, improved graphics on the website produced > with the export to POV-Ray feature available from the System-class, a > class-reference which was generated with the pydoc tool and some other > improvements. > > Enjoy, Markus > > > > _______________________________________________ > Visualpython-users mailing list > Visualpython-users@lists.sourceforge.net > http://lists.sourceforge.net/lists/listinfo/visualpython-users > From dcraig@cris.com Wed May 23 21:04:25 2001 From: dcraig@cris.com (dcraig) Date: Wed, 23 May 2001 13:04:25 -0700 Subject: [Edu-sig] Fw: NICHOLAS PETRELEY: "The Open Source" from InfoWorld.com, Wednesday, May 23, 2001 Message-ID: <002201c0e3c3$97792240$27beb0d0@p8d0i5> Hope this is appropriate to post. Dave Craig ----- Original Message ----- From: To: Sent: Wednesday, May 23, 2001 9:09 AM Subject: NICHOLAS PETRELEY: "The Open Source" from InfoWorld.com, Wednesday, May 23, 2001 > ======================================================== > NICHOLAS PETRELEY: "The Open Source" InfoWorld.com > ======================================================== > > Wednesday, May 23, 2001 > > Advertising Sponsor - - - - - - - - - - - - - - - - - - > The I's Have It > For Net Prophet Jessica Davis, the I in I-commerce stands > for insight and irreverence. There's plenty of Internet > news. Jessica's interested in what it all means - and that > doesn't mean ponderous punditry. She passes on business > tips and belly laughs along with some big ideas. Net > Prophet: prophecy to profit by, e-mailed to you every > Tuesday. To subscribe, go to > http://www.iwsubscribe.com/newsletters > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - > > > CAUGHT IN PYTHON'S GRIP > > Posted at May 18, 2001 01:01 PM PST Pacific > > > I'M A BIG FAN of the open-source programming language > called Python. In case you're wondering, Python is > indeed named after the British Broadcasting Corp. > comedy group Monty Python. It was created in about > 1990 by Guido van Rossum, a fan of Monty Python. Since > then it has matured at a phenomenal rate, thanks to > its open-source nature. > > In its current state, Python miraculously manages to > combine simplicity with incredible depth and breadth. > On the one hand, Python is very similar to Java in how > one might apply it to build solutions and the kind of > features it supports. Like Java, it is > object-oriented, runs byte code, and works well for > server-side Web applications. Like Java, you can use > Python to build client-side applets. Netscape has a > plug-in for this, but nobody seems to use it and it's > not supported anymore. Why does nobody use it? Because > you can write applets in Python and compile them into > Java byte code for use with any Java 1.1-enabled > browser. These are but a few examples of Python's depth. > > Unlike Java, Python is ideal for tossing together a > quick script to do mundane work. If you're a casual > Linux user, you have probably executed many Python > scripts and applets without knowing it. People use > Python this way because it is even easier to use for > mundane tasks than Unix shell script languages and > infinitely more powerful. That demonstrates its breadth. > > I don't mean to rekindle the Python versus Java wars > that raged a few years back. Both languages have their > place. Neither is perfect for every need, although > Python is closer to being a one-size-fits-all language > than Java. But I happen to be as big a fan of Java as > I am Python. > > I draw the comparison because you would do well to > consider both Python and Java if you're about to > embark on a new Web application project. You just > might find that Python is more appropriate for your > particular task than Java. > > One of the first things you'll notice about Python is > its unique way of grouping statements. Python uses > indentation to parse its code. Most C programmers tend > to use indentation to make their code readable. You > type an "if" statement, go to the next line, indent > farther than the "if" statement, and then type the > code that is executed if the condition is true. > > Although C programmers don't have to use indentation, > you do it simply because it makes it easier to > understand the programming logic when you come back to > the code later. In contrast, if you don't indent > Python statements properly your program won't run. You > can use tabs, spaces, or a mix of the two, but you > have to be consistent. > > That feels rather odd when you first start programming > in Python, but it only takes a few minutes before you > realize that it is not only an intuitive way to > program, it pushes you to create code that is more > readable, and therefore easier to maintain. > > The other thing you'll notice is that it is as easy to > create Python classes (objects) as it is to toss > together a procedural script. So much so that you > often end up using objects in Python even when you > don't have to. This makes your code more reusable, > which is always a good thing. > > I've barely scratched the surface of what Python is and > what it can do. If I've piqued your interest, visit > www.python.org for more information. Once you learn > your way around Python and are ready to start > programming I recommend you pick up Programming Python > by Mark Lutz, from the O'Reilly series, now in its 2nd > Edition.Next week I'll discuss options available for > server-side Web applications programming with Python. > > Nicholas Petreley is the founding editor of > VarLinux.org (www.varlinux.org) and LinuxWorld. Reach > him at nicholas@petreley.com. > > > > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - > THE LATEST IN LINUX FROM INFOWORLD: > > * New worm tries to fix infected Linux systems > - - - - - - - - - - - - - - - - - - - - - - - - - - - - > http://www.infoworld.com/articles/hn/xml/01/05/17/010517hncheese.xml?0522tul i > > * IBM unveils Linux resource portal > - - - - - - - - - - - - - - - - - - - - - - - - - - - - > http://www.infoworld.com/articles/hn/xml/01/05/11/010511hnibmlinux.xml?0522t uli > > * TO THE EDITOR > - - - - - - - - - - - - - - - - - - - - - - - - - - - - > http://www.infoworld.com/articles/op/xml/01/05/14/010514opletters.xml?0522tu li > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - > > QUOTE OF THE DAY: > > "In a little more than a month, AOL will be able to disclaim > all the warranties it wants and will be able to rely on the > law to back it up." > > --The Gripe Line's Ed Foster continues to warn readers about > the impact of the Uniform Computer Information Transactions > Act. > > http://www.infoworld.com/articles/op/xml/01/05/21/010521opfoster.xml?0523wel i > > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - > > SUBSCRIBE > To subscribe to any of InfoWorld's e-mail newsletters, > tell your friends and colleagues to go to: > http://www.iwsubscribe.com/newsletters/ > > To subscribe to InfoWorld.com, or InfoWorld Print, > or both, go to http://www.iwsubscribe.com > > UNSUBSCRIBE > If you want to unsubscribe from InfoWorld's Newsletters, > go to http://iwsubscribe.com/newsletters/unsubscribe/ > > CHANGE E-MAIL > If you want to change the e-mail address where > you are receiving InfoWorld newsletters, go to > http://iwsubscribe.com/newsletters/adchange/ > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - > > Sign up for hands-on, highly interactive courses > covering topics such as HTML, DHTML, FrontPage, Java, > Visual InterDev, and more. Even gain the latest tips on > E-Commerce and E-Business, from getting started to > marketing your E-Business. > Package: Web Development > Cost:$96.00, # of Courses: 60+, Subscription: One Year > Sign up now for InfoWorld's web-based training. > http://webtraining.infoworld.com?0523wedopensrc > > > Advertising Sponsor - - - - - - - - - - - - - - - - - - > The I's Have It > For Net Prophet Jessica Davis, the I in I-commerce stands > for insight and irreverence. There's plenty of Internet > news. Jessica's interested in what it all means - and that > doesn't mean ponderous punditry. She passes on business > tips and belly laughs along with some big ideas. Net > Prophet: prophecy to profit by, e-mailed to you every > Tuesday. To subscribe, go to > http://www.iwsubscribe.com/newsletters > > - - - - - - - - - - - - - - - - - - - - - - - - - - - - > > Copyright 2001 InfoWorld Media Group Inc. > > > > > This message was sent to: dcraig@cris.com > From dcraig@cris.com Thu May 24 08:57:42 2001 From: dcraig@cris.com (dcraig) Date: Thu, 24 May 2001 00:57:42 -0700 Subject: [Edu-sig] URL for Petereley Message-ID: <002501c0e427$37ccccc0$93bdb0d0@p8d0i5> This is a multi-part message in MIME format. ------=_NextPart_000_0022_01C0E3EC.89B1ECE0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Rob, Try http://www.iwsubscribe.com/newsletters/ Dave Craig ------=_NextPart_000_0022_01C0E3EC.89B1ECE0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Rob, Try  http://www.iwsubscribe.c= om/newsletters/
 
Dave Craig
------=_NextPart_000_0022_01C0E3EC.89B1ECE0-- From bic@cgl.ucsf.edu Thu May 24 17:59:34 2001 From: bic@cgl.ucsf.edu (Bruce Cohen) Date: Thu, 24 May 2001 09:59:34 -0700 (PDT) Subject: [Edu-sig] Reversi Message-ID: Brent- Thank you for much for posting your Reversi code on the web. I have a very sharp 9th grader TAing my intro to programming class. (Because kids have to be in at least 10th grade to take the class, he is not allowed to be an official student.) The Reversi game has been a wonderful experience for him. For example, he has written code to consider move trees, and has a few different ways of evaluating the trees for his next move. Your code is very nice in that the student does not have to worry about the details of how you programmed the game. S/he can focus on strategies. Sam has also written a program that plays Reversi in batch mode so that he can has the computer play thousands of games to test his strategies. -Bruce Bruce Cohen | e-mail: bic@cgl.ucsf.edu Lowell High School | http://www.cgl.ucsf.edu/home/bic From aschmidt@nv.cc.va.us Thu May 24 18:15:25 2001 From: aschmidt@nv.cc.va.us (Schmidt, Allen J.) Date: Thu, 24 May 2001 13:15:25 -0400 Subject: [Edu-sig] Reversi Message-ID: <5CDFEBB60E7FD311B9E30000F6D6090688C06A@novamail.nvcc.vccs.edu> I must have missed the Reversi post... I would love to get this code. Trying to get my 8th grader(14) to starting working in Python and Zope. I work across the street from Digital Creations in Fredericksburg, Virginia - the new home of python.org - and would love for him to get more involved with those tools and shoot for some wonderful LOCAL opportunities in the future. We also use Zope and Python extensively in the group I am in working at the local newspaper...The Free Lance-Star (www.fredericksburg.com) which is all done in Zope (the web side.) I can almost guarantee a job at the paper for him if I could get him interested in those tools. My other 3 kids (8,11,13) work on the PC and can navigate and play games, etc. but have shown no programming interest. My son has been programming since he was 8 in QBasic and then on to Visual Basic 5 and now 6. All self taught. He has done some neat things but I would like to get him (them) more involved in web technologies. So, bottom line, I would like the Reversi code if possible, and suggestions and directions for getting my 'gang' interested in Python. BTW, we home school all four and I would like to have some curriculum to use to teach programming to them. Any suggestions there are appreciated as well. THANKS!!! Allen Schmidt Programmer/Analyst for Northern VA Community College AND also for... The Free Lance-Star fredericksburg.com -----Original Message----- From: Bruce Cohen [mailto:bic@cgl.ucsf.edu] Sent: Thursday, May 24, 2001 1:00 PM To: erburley@ix.netcom.com Cc: edu-sig@python.org Subject: [Edu-sig] Reversi Brent- Thank you for much for posting your Reversi code on the web. I have a very sharp 9th grader TAing my intro to programming class. (Because kids have to be in at least 10th grade to take the class, he is not allowed to be an official student.) The Reversi game has been a wonderful experience for him. For example, he has written code to consider move trees, and has a few different ways of evaluating the trees for his next move. Your code is very nice in that the student does not have to worry about the details of how you programmed the game. S/he can focus on strategies. Sam has also written a program that plays Reversi in batch mode so that he can has the computer play thousands of games to test his strategies. -Bruce Bruce Cohen | e-mail: bic@cgl.ucsf.edu Lowell High School | http://www.cgl.ucsf.edu/home/bic _______________________________________________ Edu-sig mailing list Edu-sig@python.org http://mail.python.org/mailman/listinfo/edu-sig From agauld@crosswinds.net Fri May 25 00:34:45 2001 From: agauld@crosswinds.net (Alan Gauld) Date: Fri, 25 May 2001 00:34:45 +0100 Subject: [Edu-sig] Reversi Message-ID: <3b0d9be7.34d9.0@crosswinds.net> >I must have missed the Reversi post... > >I would love to get this code. Trying to get my 8th > grader(14) to starting working in Python and Zope. You might like my guessing games framework which is on the useless python site. Its an abstract OO framework for building guessing games with an implementation of text based hangman and a gui version of the same game. I also have used it to build mastermind and paper rock & scissors too (but they are in Java, using the same OO design). Its fully described as a case study in my book but the useless python version is pretty extensively commented. Alan g. From cmeyers@guardnet.com Fri May 25 02:40:15 2001 From: cmeyers@guardnet.com (Chris Meyers) Date: Thu, 24 May 2001 17:40:15 -0800 Subject: [Edu-sig] Python for Fun Message-ID: Hi, I would like to introduce myself and offer my first posting to the group. My name is Chris Meyers and I've been working with Jeff Elkner and his Python class at Yorktown High School on the Open Book Project. I'm working primarily on Python case studies for intermediate students. The first 4 (of hopefully a dozen) can be found at www.ibiblio.org/cmeyers. These programs are some of my favorites from many years of programming. They are all short, just a page or two but should demonstrate good use of recursion and objects with algorithms that are a little beyond the ordinary. You will be led to a writeup that should explain the code in detail. These 1st 4 are Logic Circuits. Simulation of logic gates with object classes that make good use of inheritance. This study starts with AND, OR, NOT gates and builds up to a four-bit binary adder. Several students are extending this study at Yorktown. Lisp in Python. A study of the classic evalquote mechanism. We end up with an interactive lisp similar to interactive python. Tower of Hanoi. A reworking of the standard algoritm to use objects sending messages. Includes a classroom exercise where students play the objects User Input. An extension of raw_input and input functions to provide a scripting mechanism. Used by Lisp in Python to load files. I've been a programmer for nearly 30 years, and have used a lot of languages. I work at the daily newspaper in Eugene Oregon, the Register Guard. I found Python about 5 years ago and tried it on a text processing project and it worked so well we've never looked back. Now 8 people program with it daily, and it is absolutely the language of choice for all new projects. The production of our internet newspaper is automated with Python code to the extent that it requires only about 1.5 hours a day for someone to produce. You can see it at www.registerguard.com. We are converting all of our old systems on VAX computers to Unix using Python and SQL. 2 years ago we converted our circulation system from Cobol to a combination of VB, Python, and SQL. The amount of code was reduced a factor of six, the system runs well, changes are easy, everyone is happy. On a personal note, I've really grown to love this language (Thanks Guido!!) Lots of reasons, but you all know them and I would be just preaching to the choir. Assuming we get enough students (and I'm getting a lot of interest) I'll be teaching a beginning Python class at our community college this summer. It's short, only 15 hours. But it will be mostly adults and should be interesting to see how far we get. Thanks, Chris From jeff@elkner.net Fri May 25 14:13:51 2001 From: jeff@elkner.net (Jeffrey Elkner) Date: 25 May 2001 09:13:51 -0400 Subject: [Edu-sig] Re: Python for Fun - Case Studys In-Reply-To: References: Message-ID: <990796451.1729.0.camel@mdeicaza> Hi Chris! The link to "Python for Fun" is up at http://www.ibiblio.org/obp Lex will want to change the image i'm sure, but i wanted something up right away. Please send me any changes you would like to make to the description. Thanks! jeff On 24 May 2001 10:56:59 -0800, Chris Meyers wrote: > Sure Jeff. And of course I'll also include a link back to the OBP > page. Also to extensions your students are doing. The logic circuit > one though seems to be still under construction? I'll keep an eye > on it. > > Thanks, Chris From aschmidt@nv.cc.va.us Fri May 25 16:12:24 2001 From: aschmidt@nv.cc.va.us (Schmidt, Allen J.) Date: Fri, 25 May 2001 11:12:24 -0400 Subject: [Edu-sig] Python for Fun Message-ID: <5CDFEBB60E7FD311B9E30000F6D6090688C06D@novamail.nvcc.vccs.edu> Hi Chris! I too work for a newspaper - The Free Lance-Star - in Fredericksburg, Virginia (www.fredericksburg.com). We are using Zope mixed with Python, XML and SQL to handle the automated production of our paper online. Working out very well and having a great time with Zope! Made our jobs a lot easier. Would love to hear of anything you can offer for teaching Python. We are Zopeheads here and some are more versed in Python than others...only using it for things we need to for interactiion in Zope. Trying to get a curriculum for teaching younger students (8-14) for our home schooling computer classes. Allen Schmidt aschmidt@fredericksburg.com -----Original Message----- From: Chris Meyers To: edu-sig@python.org Sent: 5/24/2001 9:40 PM Subject: [Edu-sig] Python for Fun Hi, I would like to introduce myself and offer my first posting to the group. My name is Chris Meyers and I've been working with Jeff Elkner and his Python class at Yorktown High School on the Open Book Project. I'm working primarily on Python case studies for intermediate students. The first 4 (of hopefully a dozen) can be found at www.ibiblio.org/cmeyers. These programs are some of my favorites from many years of programming. They are all short, just a page or two but should demonstrate good use of recursion and objects with algorithms that are a little beyond the ordinary. You will be led to a writeup that should explain the code in detail. These 1st 4 are Logic Circuits. Simulation of logic gates with object classes that make good use of inheritance. This study starts with AND, OR, NOT gates and builds up to a four-bit binary adder. Several students are extending this study at Yorktown. Lisp in Python. A study of the classic evalquote mechanism. We end up with an interactive lisp similar to interactive python. Tower of Hanoi. A reworking of the standard algoritm to use objects sending messages. Includes a classroom exercise where students play the objects User Input. An extension of raw_input and input functions to provide a scripting mechanism. Used by Lisp in Python to load files. I've been a programmer for nearly 30 years, and have used a lot of languages. I work at the daily newspaper in Eugene Oregon, the Register Guard. I found Python about 5 years ago and tried it on a text processing project and it worked so well we've never looked back. Now 8 people program with it daily, and it is absolutely the language of choice for all new projects. The production of our internet newspaper is automated with Python code to the extent that it requires only about 1.5 hours a day for someone to produce. You can see it at www.registerguard.com. We are converting all of our old systems on VAX computers to Unix using Python and SQL. 2 years ago we converted our circulation system from Cobol to a combination of VB, Python, and SQL. The amount of code was reduced a factor of six, the system runs well, changes are easy, everyone is happy. On a personal note, I've really grown to love this language (Thanks Guido!!) Lots of reasons, but you all know them and I would be just preaching to the choir. Assuming we get enough students (and I'm getting a lot of interest) I'll be teaching a beginning Python class at our community college this summer. It's short, only 15 hours. But it will be mostly adults and should be interesting to see how far we get. Thanks, Chris _______________________________________________ Edu-sig mailing list Edu-sig@python.org http://mail.python.org/mailman/listinfo/edu-sig From pdx4d@teleport.com Fri May 25 16:29:20 2001 From: pdx4d@teleport.com (Kirby Urner) Date: Fri, 25 May 2001 08:29:20 -0700 Subject: [Edu-sig] Python for Fun In-Reply-To: <5CDFEBB60E7FD311B9E30000F6D6090688C06D@novamail.nvcc.vccs. edu> Message-ID: <3.0.3.32.20010525082920.014bdde0@pop3.norton.antivirus> Bruce Eckel has a 25 minute RealVideo interview from Python 9 at the Dr Dobbs technetcast site. Recommended: http://technetcast.ddj.com/tnc_play_stream.html?stream_id=466 Chris -- I've been studying your code, logic.py especially. Good stuff. Gets me thinking... Kirby From pdx4d@teleport.com Fri May 25 20:55:29 2001 From: pdx4d@teleport.com (Kirby Urner) Date: Fri, 25 May 2001 12:55:29 -0700 Subject: [Edu-sig] Python for Fun In-Reply-To: Message-ID: <3.0.3.32.20010525125529.013a9ca8@pop3.norton.antivirus> Just for fun: tweaking logic.py Connector class with 2.1 idioms: def connect (self, inputs) : if type(inputs) != type([]) : inputs = [inputs] self.connects += inputs # <-- here def set (self, value) : if self.value == value : return # Ignore if no change self.value = value if self.activates : self.owner.evaluate() if self.monitor : print "Connector %s-%s set to %s" % \ (self.owner.name,self.name,self.value) [con.set(value) for con in self.connects] # <-- and here Could also go: self.connects.extend(inputs) (is that 1.5 or later?) I find it interesting that you can define lists simply for their side-effects, with the list itself saved nowhere. Indeed, you can stick [1,2,3] (no assignment to a variable) anywhere a method and nothing happens -- __repr__ isn't triggered except at the command line. I did have map(lambda con: con.set(value), self.connects) which makes use of nested scopes (value in lambda is getting a pointer from the surrounding method), but list comprehension doesn't see this as a case of scope nesting i.e. variables within the brackets are locally scoped already. Seems to me that list comprehension was already providing a way to work around some of little lambda's awkwardness, even without the from __future__ import nested_scopes option. Kirby From cmeyers@guardnet.com Fri May 25 22:33:11 2001 From: cmeyers@guardnet.com (Chris Meyers) Date: Fri, 25 May 2001 13:33:11 -0800 Subject: [Edu-sig] Python for Fun Message-ID: Hi Allen, I think I need to learn at lot more about Zope. Most of what we're doing here involves a marriage between database tables and Python dictionaries turned into objects. We made a small extension to the Sybase module to retrieve data from SQL queries, mold them into dictionarys, and attach as attributes to created objects. It was technology that was effective even 5 years ago. I don't have much to offer for teaching yet. But I'll try to keep track this summer. Syllabus, what works, what dont. I assume you've seen Jeff Elkners book at www.ibiblio.org/obp and projects his high school class is doing. Chris 05/25/2001 12:12:24 PM, "Schmidt, Allen J." wrote: >Hi Chris! > >I too work for a newspaper - The Free Lance-Star - in Fredericksburg, >Virginia (www.fredericksburg.com). We are using Zope mixed with Python, XML >and SQL to handle the automated production of our paper online. Working out >very well and having a great time with Zope! Made our jobs a lot easier. > >Would love to hear of anything you can offer for teaching Python. We are >Zopeheads here and some are more versed in Python than others...only using >it for things we need to for interactiion in Zope. > >Trying to get a curriculum for teaching younger students (8-14) for our home >schooling computer classes. > >Allen Schmidt >aschmidt@fredericksburg.com > From aschmidt@nv.cc.va.us Fri May 25 21:46:37 2001 From: aschmidt@nv.cc.va.us (Schmidt, Allen J.) Date: Fri, 25 May 2001 16:46:37 -0400 Subject: [Edu-sig] Python for Fun Message-ID: <5CDFEBB60E7FD311B9E30000F6D6090688C070@novamail.nvcc.vccs.edu> Zope works great in the newspaper business. The stories come from the print-side database as XML files and the whole lot is FTPd up to our server overnight. An automatic script runs in the early morning to run through each story, grab the properties of each (and any photos attached to the story) add them into the Zope database and catalog each one. The the catagories are pulled out and they are organized into groups; localities, sports, obits, etc. Then when they are in, another script runs and the catalog index is built which is what you see on our front page. All(most) is automatically done - a process that used to take a guy all night to do by hand dealing with static text files. Zope is a great tool and fun too! Changes all the time and we keep bolting on new stuff. Yes, please let me know how your courses go! Good luck! Allen -----Original Message----- From: Chris Meyers To: Schmidt Allen J.; 'Chris Meyers '; 'edu-sig@python.org ' Sent: 5/25/2001 5:33 PM Subject: RE: [Edu-sig] Python for Fun Hi Allen, I think I need to learn at lot more about Zope. Most of what we're doing here involves a marriage between database tables and Python dictionaries turned into objects. We made a small extension to the Sybase module to retrieve data from SQL queries, mold them into dictionarys, and attach as attributes to created objects. It was technology that was effective even 5 years ago. I don't have much to offer for teaching yet. But I'll try to keep track this summer. Syllabus, what works, what dont. I assume you've seen Jeff Elkners book at www.ibiblio.org/obp and projects his high school class is doing. Chris 05/25/2001 12:12:24 PM, "Schmidt, Allen J." wrote: >Hi Chris! > >I too work for a newspaper - The Free Lance-Star - in Fredericksburg, >Virginia (www.fredericksburg.com). We are using Zope mixed with Python, XML >and SQL to handle the automated production of our paper online. Working out >very well and having a great time with Zope! Made our jobs a lot easier. > >Would love to hear of anything you can offer for teaching Python. We are >Zopeheads here and some are more versed in Python than others...only using >it for things we need to for interactiion in Zope. > >Trying to get a curriculum for teaching younger students (8-14) for our home >schooling computer classes. > >Allen Schmidt >aschmidt@fredericksburg.com > From cmeyers@guardnet.com Fri May 25 23:31:39 2001 From: cmeyers@guardnet.com (Chris Meyers) Date: Fri, 25 May 2001 14:31:39 -0800 Subject: [Edu-sig] Python for Fun Message-ID: 05/25/2001 1:55:29 PM, Kirby Urner wrote: Hi Kirby, We're still on Python 1.5.3 mainly because we have so much code in running systems that upgrading involves a lot of regression testing. Try for this summer for sure. Lots of stuff out there that assumes 2.0 as a base. Zope, Vpython, wxPython, etc. A year ago we upgraded from 3.0 and had some glitches - mostly with comparisons where one value was None. >Just for fun: tweaking logic.py Connector class with 2.1 idioms: > > def connect (self, inputs) : > if type(inputs) != type([]) : inputs = [inputs] > self.connects += inputs # <-- here > This is a nice new feature (+= etc.). Does it save time and evaluate the left hand address only once? Or is it just syntactic sugar? If the calculation is complex, it can make a real difference in program speed. Like array[n][nextSlot(whatever)] += 1 Or in our case we are very often incrementing (or the like) an object attribute, which is a really a dict lookup. Don't want to do the lookup twice. > def set (self, value) : > if self.value == value : return # Ignore if no change > self.value = value > if self.activates : self.owner.evaluate() > if self.monitor : > print "Connector %s-%s set to %s" % \ > (self.owner.name,self.name,self.value) > [con.set(value) for con in self.connects] # <-- and here > This should also save time, I would think, since the list is not constantly resized? Can't test it. Don't work on 1.5.3 > >Could also go: > > self.connects.extend(inputs) (is that 1.5 or later?) > Is this actually different from .append ? > >I find it interesting that you can define lists simply for >their side-effects, with the list itself saved nowhere. Indeed, >you can stick [1,2,3] (no assignment to a variable) anywhere >a method and nothing happens -- __repr__ isn't triggered >except at the command line. > That's kind of cool. I had never tried it. Replace 1,2,3 with function calls and off they go, left to right. This reminds me of the old Lisp "PROG" that would evaluate its arguments just for the side effects. >I did have > > map(lambda con: con.set(value), self.connects) > >which makes use of nested scopes (value in lambda is getting a >pointer from the surrounding method), but list comprehension >doesn't see this as a case of scope nesting i.e. variables >within the brackets are locally scoped already. > I tried this and it seemed to work >>> >>> class con : ... def __init__ (self) : ... self.x = 5 ... def prnt (selfi,c) : ... print self.x + c ... >>> a = con() >>> b = [a,a,a] >>> map(lambda x: x.prnt(4), b) 9 9 9 [None, None, None] >>> Speaking of scoping. If you get around to Lisp in Python, there's a section on dynamic scoping with an example. Chris From delza@alliances.org Sat May 26 05:10:04 2001 From: delza@alliances.org (Dethe Elza) Date: Fri, 25 May 2001 21:10:04 -0700 Subject: [Edu-sig] Python for Fun In-Reply-To: Message-ID: Hi Chris > We're still on Python 1.5.3 mainly because we have so much code in > running systems that upgrading involves a lot of regression > testing. Try for this summer for sure. Lots of stuff out there that > assumes 2.0 as a base. Zope, Vpython, wxPython, etc. A year ago we > upgraded from 3.0 and had some glitches - mostly with comparisons > where one value was None. Actually, Zope still uses Python 1.5.x for much the same reasons: lots of code to evaluate. The next release will be for 2.0, I think. Likewise, wxPython and VPython were running on 1.5 until recently, so there should either be a 1.5 branch of the current version, or an older install which will work for you to play with. RedHat Linux (and others, I'm sure) still seems to be shipping/using 1.5 (RedHat uses Python for their installer and lots of utilities), and it has a tremendous installed base, so lots of folks still support it in their tools. >> Just for fun: tweaking logic.py Connector class with 2.1 idioms: >> >> def connect (self, inputs) : >> if type(inputs) != type([]) : inputs = [inputs] >> self.connects += inputs # <-- here >> > This is a nice new feature (+= etc.). Does it save time and > evaluate the left hand address only once? Or is it just syntactic > sugar? If the calculation is complex, it can make a real difference > in program speed. Like > > array[n][nextSlot(whatever)] += 1 > Or in our case we are very often incrementing (or the like) an > object attribute, which is a really a dict lookup. Don't want to do > the lookup twice. Augmented assignments ( x += y instead of x = x + y, etc.) were done as part of PEP 203 (Python Enhancement Proposal), and according to that the left-hand side is indeed evaluated only once. http://python.sourceforge.net/peps/pep-0203.html >> def set (self, value) : >> if self.value == value : return # Ignore if no change >> self.value = value >> if self.activates : self.owner.evaluate() >> if self.monitor : >> print "Connector %s-%s set to %s" % \ >> (self.owner.name,self.name,self.value) >> [con.set(value) for con in self.connects] # <-- and here >> > This should also save time, I would think, since the list is not > constantly resized? Can't test it. Don't work on 1.5.3 Not sure what the issue is here. >> Could also go: >> >> self.connects.extend(inputs) (is that 1.5 or later?) >> > Is this actually different from .append ? I believe extend adds a list to a list, making a list which is the union. Append would take the additional list and make it a single node of the first list (lengthening by one rather than by the length of the added list). >> I find it interesting that you can define lists simply for >> their side-effects, with the list itself saved nowhere. Indeed, >> you can stick [1,2,3] (no assignment to a variable) anywhere >> a method and nothing happens -- __repr__ isn't triggered >> except at the command line. >> > That's kind of cool. I had never tried it. Replace 1,2,3 with > function calls and off they go, left to right. This reminds me of > the old Lisp "PROG" that would evaluate its arguments just for the > side effects. > >> I did have >> >> map(lambda con: con.set(value), self.connects) >> >> which makes use of nested scopes (value in lambda is getting a >> pointer from the surrounding method), but list comprehension >> doesn't see this as a case of scope nesting i.e. variables >> within the brackets are locally scoped already. >> > > I tried this and it seemed to work >>>> >>>> class con : > ... def __init__ (self) : > ... self.x = 5 > ... def prnt (selfi,c) : > ... print self.x + c > ... >>>> a = con() >>>> b = [a,a,a] >>>> map(lambda x: x.prnt(4), b) > 9 > 9 > 9 > [None, None, None] >>>> > Speaking of scoping. If you get around to Lisp in Python, there's a > section on dynamic scoping with an example. > > Chris > -- Dethe Elza Chief Mad Scientist Burning Tiger Technologies From pdx4d@teleport.com Sat May 26 06:17:06 2001 From: pdx4d@teleport.com (Kirby Urner) Date: Fri, 25 May 2001 22:17:06 -0700 Subject: [Edu-sig] Python for Fun In-Reply-To: Message-ID: <3.0.3.32.20010525221706.013a1df4@pop3.norton.antivirus> >>Could also go: >> >> self.connects.extend(inputs) (is that 1.5 or later?) >> >Is this actually different from .append ? It's different with later versions because in those append only accepts a single argument e.g.: >>> a = [1,2,3] >>> a.append([4,5,6]) >>> a [1, 2, 3, [4, 5, 6]] >>> a = [1,2,3] >>> a.extend([4,5,6]) >>> a [1, 2, 3, 4, 5, 6] >I tried this and it seemed to work >>>> >>>> class con : >... def __init__ (self) : >... self.x = 5 >... def prnt (selfi,c) : >... print self.x + c >... >>>> a = con() >>>> b = [a,a,a] >>>> map(lambda x: x.prnt(4), b) >9 >9 >9 >[None, None, None] If I use the following as my def of set in the Connector class: def set (self, value) : if self.value == value : return # Ignore if no change self.value = value if self.activates : self.owner.evaluate() if self.monitor : print "Connector %s-%s set to %s" % (self.owner.name,self.name,self.value) map(lambda con: con.set(value), self.connects) Then upon import I get the warning: d:\program files\python21\ocn\logic.py:25: SyntaxWarning: local name 'value' in 'set' shadows use of 'value' as global in nested scope 'lambda' self.value = value And the program crashes when using test4Bit: >>> test4Bit('1001','1110') Connector F0-Cin set to 0 Traceback (most recent call last): File "", line 1, in ? test4Bit('1001','1110') File "d:\program files\python21\ocn\logic.py", line 124, in test4Bit F0.Cin.set(0) File "d:\program files\python21\ocn\logic.py", line 32, in set map(lambda con: con.set(value), self.connects) File "d:\program files\python21\ocn\logic.py", line 32, in map(lambda con: con.set(value), self.connects) NameError: global name 'value' is not defined However, if I insert: from __future__ import nested_scopes at the top of logic.py, then the code reloads w/o warnings and runs fine, because with nested scopes, lambda is perfectly able to see the value of 'value' without needing to have that passed explicitly, as in: map(lambda con, value=value: con.set(value), self.connects) ...which works OK without the nested_scopes feature (probably in 1.5.3 as well then). It's this value=value stuff that the nested scopes feature is designed to avoid/obviate. Another experiment: if I write a test module named test2.py with the following function only: def test(x): y=5 return map(lambda x: x+y, [x]) then on import I get the warning: >>> import test2 d:\program files\python21\ocn\test2.py:1: SyntaxWarning: local name 'y' in 'test' shadows use of 'y' as global in nested scope 'lambda' def test(x): but if I add the line: from __future__ import nested_scopes to the top of the test2.py module and reload, then y is captured in the lambda. No warnings, function works: >>> test2.test(10) [15] What I find interesting is that I can't make the above function work in IDLE if I enter it at the command line, even if I enter from __future__ import nested_scopes. In other words, whereas adding this 2.1-only import statement to the top of a module suppresses the warning and makes the code OK, entering this import statement at the command line doesn't salvage the code. >>>> >Speaking of scoping. If you get around to Lisp in Python, there's a >section on dynamic scoping with an example. > >Chris I did study the Lisp example for awhile. I'm always awed by LISP and all that tail recursion. Yet the LISP _does_ have looping syntax in the versions I've seen. It's Scheme that stays purist about using only recursion for looping, no? >From what I understand of all this, Python isn't really tail recursive under the hood. Am I right about that? Building more complicated circuits with your logic gates would be fun. I've got this 'Beebop to the Boolean Boogie' book that'd make a good guide for testing out some other circuits. Dunno when/if I'll get to do it. Kirby From wilson@visi.com Sat May 26 06:19:50 2001 From: wilson@visi.com (Timothy Wilson) Date: Sat, 26 May 2001 00:19:50 -0500 (CDT) Subject: [Edu-sig] Learning Python in pairs Message-ID: I'm watching a RealVideo interview with Bob Martin, author, consultant, and chief promoter of the Extreme Programming methodology. *I am not a professional software developer*, but I find the collaborative nature of the process intriguing. I'm going to have two sections of about 25 students each next fall and I have a lab with 30 computers. I'm intrigued by the idea of having the students work in pairs. (This is something we science teachers are very comfortable with.) Do any list subscribers have any thoughts about solo vs. paired learning in a programming class? -Tim -- Tim Wilson | Visit Sibley online: | Check out: Henry Sibley HS | http://www.isd197.org | http://www.zope.org W. St. Paul, MN | | http://slashdot.org wilson@visi.com | | http://linux.com From jasonic@nomadicsltd.com Sat May 26 07:10:40 2001 From: jasonic@nomadicsltd.com (Jason Cunliffe) Date: Sat, 26 May 2001 02:10:40 -0400 Subject: [Edu-sig] Python for Fun References: Message-ID: <001001c0e5aa$97473080$c3090740@megapathdsl.net> > Actually, Zope still uses Python 1.5.x for much the same reasons: lots of > code to evaluate. The next release will be for 2.0, I think. Likewise, > wxPython and VPython were running on 1.5 until recently, so there should > either be a 1.5 branch of the current version, or an older install which > will work for you to play with. RedHat Linux (and others, I'm sure) still > seems to be shipping/using 1.5 (RedHat uses Python for their installer and > lots of utilities), and it has a tremendous installed base, so lots of folks > still support it in their tools. Considerable effort now under way to bring and Python into sync - looking like Zope 2.4 with Python 2.1. On Windows Zope installs with its own Python included. So I gather that starting from Zope 2.4 this will include Python 2.1 Meanwhile Python 1.5.2 appears to be the default, most widely installed etc. Looks like 6-9 months of mild versionitis up ahead until Python 2.1 [or later] becomes richly used and the fully supported reference. Since installing Python is so easy I do not see there is much problem. The admin issue is keepiing up with the upgrades in a clean quick manner. Particualrly all the additional modules one has. Zope now has an $INSTANCE_HOME variable one can asign to different directory, located whrever you wish,to store any the non-standard modules, Zope 'products' etc. This is a big improvement. Convenient, maintainable, flexible. How do you recommned smooth handling of Python modules placement, path assignment, for miminimizing upgrade pain. ? I usually use brute copy and paste of folders, then fix any version errors when prompted. But it is messy and makes me feel dumb. ./Jason From rnd@onego.ru Sat May 26 09:14:19 2001 From: rnd@onego.ru (Roman Suzi) Date: Sat, 26 May 2001 12:14:19 +0400 (MSD) Subject: [Edu-sig] The Programmers Stone Message-ID: Hello! Probably I am not original, but I think this is very important for cp4e philosophy: http://www.reciprocality.org/Reciprocality/r0/index.html It actually says WHY cp is not 4e and WHAT to do. I recalled the progstone because it's very essential to the problem of cp4e: only Mappers could _program_ what they want, Packers just recall instructions to do something and have trouble when they aren't available in their memory, local library or the Internet ;-) Roman Suzi Sincerely yours, Roman Suzi -- _/ Russia _/ Karelia _/ Petrozavodsk _/ rnd@onego.ru _/ _/ Saturday, May 26, 2001 _/ Powered by Linux RedHat 6.2 _/ _/ "Women do come with instructions; ask them." _/ From robnospam@jam.rr.com Sat May 26 13:37:58 2001 From: robnospam@jam.rr.com (Rob Andrews) Date: Sat, 26 May 2001 07:37:58 -0500 Subject: [Edu-sig] The Programmers Stone References: Message-ID: <3B0FA3A6.6F4E143C@jam.rr.com> Roman Suzi wrote: > > Hello! > > Probably I am not original, but I think this > is very important for cp4e philosophy: > > http://www.reciprocality.org/Reciprocality/r0/index.html > > It actually says WHY cp is not 4e and WHAT to do. > > I recalled the progstone because it's very essential to the > problem of cp4e: only Mappers could _program_ what they want, > Packers just recall instructions to do something and > have trouble when they aren't available in their memory, > local library or the Internet ;-) > > Roman Suzi > Thanks for posting this one. I've never run across it before. If anyone has a favorite link or three (including to your own sites) you would care to share, I'm sure Useless Python could benefit from them. It's a site focused on providing source code, challenges, and a place to post solutions to ACM programming contest problems in Python. The goal is to provide some tangible goals for new students (or enthusiasts, such as myself) of Python to play/work with. We already have some excellent links directly related to Python (although always keeping an eye out for more), but would certainly benefit from more links to sources of info on programming and problem solving in general. Happy Saturday, Rob -- You should have listened when your mother warned you about Useless Python! http://www.lowerstandard.com/python/pythonsource.html From sheila@thinkspot.net Sat May 26 15:58:05 2001 From: sheila@thinkspot.net (Sheila King) Date: Sat, 26 May 2001 07:58:05 -0700 Subject: [Edu-sig] Learning Python in pairs In-Reply-To: References: Message-ID: <207B3791C41@kserver.org> On Sat, 26 May 2001 00:19:50 -0500 (CDT), Timothy Wilson wrote about [Edu-sig] Learning Python in pairs: :I'm going to have two sections of about 25 students each next fall and I :have a lab with 30 computers. I'm intrigued by the idea of having the :students work in pairs. (This is something we science teachers are very :comfortable with.) Do any list subscribers have any thoughts about solo :vs. paired learning in a programming class? I do use pairs for a number of things in my programming class. Usually a difficult assignment is done with a partner. There are many benefits to working with a partner. For example: It gives you someone to talk with about the ideas. In my classroom, when I have them work with a partner, there is a LOT of discussion, and anything that gets them thinking about programming and talking about it is good. Plus, when you are talking to a partner, you have to think about it at least enough to present your ideas and thoughts coherently. I don't have them work with a partner all the time. Probably less than half the time. They have to write their quizzes and tests individually, so some programs must be done individually. But I do find a lot of value from the partner thing. (This is in an AP Comp Sci C++ course.) -- Sheila King http://www.thinkspot.net/sheila/ http://www.k12groups.org/ From matthias@rice.edu Sat May 26 16:17:18 2001 From: matthias@rice.edu (Matthias Felleisen) Date: Sat, 26 May 2001 10:17:18 -0500 (CDT) Subject: [Edu-sig] Lisp vs Scheme vs Python In-Reply-To: (edu-sig-request@python.org) References: Message-ID: <200105261517.KAA12158@africa.cs.rice.edu> Kirby writes: I did study the Lisp example for awhile. I'm always awed by LISP and all that tail recursion. Yet the LISP _does_ have looping syntax in the versions I've seen. It's Scheme that stays purist about using only recursion for looping, no? Lisp is _not_ tail-call optimizing by standard, and indeed, I don't know of a Lisp implementation that performs tail-call optimizations. Scheme is tail-call optimizing by standard, though there are implementations that break tail-call optimizations. As a result, there is no _need_ for looping constructs in Scheme yet there is a need for such beasts in Lisp. In that reagrad, Lisp and Python are quite similar. Of course, "need" does not imply that Scheme doesn't provide a looping construct. As a matter of fact, the language includes a do macro for just that purpose. The problem with forcing looping constructs is that they force programmers to produce code whose structures doesn't match the structure of the data. If you look at the definition of NAT, you see linear induction. A linear recursion in code matches this definition. If you look at the definition of LIST you see ... and so on. Python and Lisp fail programmers in that regard. With Python and Lisp you must teach kids "look at this example, modify it, follow my suggestions" and hope that it eventually clicks. Of course, the interactive nature of Lisp's evaluator (since 1958?) and of Python's interactive REPL (uh, IDLE, since 1995?) help students explore quickly and absorb these micro patterns. Still, in the end if they are confronted with an unusual data class, they fail to come up with code. I tested dozens and hundreds of students on that. They all had introductions in Pascal or C (min 1 year) and couldn't write a function that traversed a non-standard data class if their life depended on it. -- Matthias Matthias Felleisen Professor of Computer Science Northeastern University, Boston Rice University, Houston For a new way to look at the world of high school computing, see http://www.teach-scheme.org/ http://www.htdp.org/ "Computer Science is no more about computers than astronomy is about telescopes." -- E. W. Dijkstra From pdx4d@teleport.com Sat May 26 17:11:17 2001 From: pdx4d@teleport.com (Kirby Urner) Date: Sat, 26 May 2001 09:11:17 -0700 Subject: [Edu-sig] Lisp vs Scheme vs Python In-Reply-To: <200105261517.KAA12158@africa.cs.rice.edu> References: Message-ID: <3.0.3.32.20010526091117.014df79c@pop3.norton.antivirus> > Still, in the end if they are confronted with an unusual data class, > they fail to come up with code. I tested dozens and hundreds of > students on that. They all had introductions in Pascal or C (min 1 > year) and couldn't write a function that traversed a non-standard > data class if their life depended on it. > > -- Matthias Are you saying these students usually don't hit on recursive solutions? If so, I don't wonder. Recursion is usually perceived as rather exotic and someone who always thinks in terms of for and while loops may well not come up with the recursive solution when called upon. This situation might be addressed by using recursion more often in Pascal or C (or Python). For example, some of these algorithms Chris just shared make good use of this strategy (the Tower of Hanoi is a classic way of introducing this construct). Probably more than prefix notation, the use of recursion in place of loops, even for the simplest algorithms, presents the biggest adjustment in thinking for the would-be Scheme learner -- especially if coming from another language tradition that doesn't emphasize it so much (even if the language supports it). You say Scheme permits a loop concept by means of macros. To someone who learned Python as a first language, this won't mean much to them, since Python has no macros -- the very concept will be undefined. I agree that some data structures are most adequately dealt with using recursion (Chris's circuits seem a good example). On the other hand, I don't see sequential iteration as foreign to everyday experience either -- it's like a conveyor belt, where you stand on the side and do the same thing to each object that goes by, perhaps accumulating some totals. Or take the sigma notation in mathematics: successive substitution of an incrementing index, with summation of all the resulting terms. Such sigmas are the raw material of many an algorithm, but I have trouble thinking of these as "more naturally" recursive than simply iterative. Perhaps I need my thinking cap adjusted. Kirby PS: thanks for more background on Lisp vs. Scheme. Going back to some emails from a Lisper trying to educate me on the basics, I find (> = me, = teacher): > I think I'm talking about more than just prefix notation, > although that's part of it. Heavy use of recursion would > be another part. But that's a Scheme thing, not a Lisp thing. Lisp has a large number of iteration constructs, and the use of recursion to do iteration, as in Scheme, is rather frowned upon. In fact, since Lisp doesn't guarantee to do tail-recursion elimination, writing Scheme in Lisp can easily lead to stack overflows. [Most Lisp implementations *do* do tail call elimination, but only at non-default optimization settings, where debuggability isn't considered important...disappearing stack frames makes debugging a pain] This guy didn't like Scheme though: Scheme? Oh, yeah, that nasty little Algol dialect that tries to look like Lisp. I abhor Scheme. Here's what I thinks of Python (vs. LISP): For me, Python's functionality is a proper subset of Lisp's[1], and Lisp is faster (both in execution time and in coding time) and easier to use, so I don't have much use for Python; but its design is simple enough to understand what's going on without much actual experience (though I completely failed to understand the document about metaclasses (which I thought was in the Python src directory, but I can't find it now) when I read it, despite having _used_ metaclasses in Lisp...) I doubt that it's possible to know Lisp very well without coming to understand the huge advantage of S-expression syntax (which, by the way, you don't have with Scheme -- Scheme source is just text) and a programmable reader; and having had that, I'd think it'd be hard to be happy with anything less. I downloaded a LISP awhile back and played with it some, studied the CLOS object system. And of course I have DrScheme and very much admire its easy interface and learner orientation (e.g. different language levels). From erburley@ix.netcom.com Sun May 27 15:57:55 2001 From: erburley@ix.netcom.com (Brent Burley and Pat Erb) Date: Sun, 27 May 2001 07:57:55 -0700 Subject: [Edu-sig] Python accessibility Message-ID: <000b01c0e6bd$89f64740$b352d8ce@68k2f01> This is a multi-part message in MIME format. ------=_NextPart_000_0008_01C0E682.BCF3B8C0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Python is a very accessible (and very capable) language. However, if = you don't have Python on your system, it's not very accessible, and if = you don't have an Internet connection, you're out of luck. Even if you = have a broadband connection, you have a lot of work ahead of you, far = more than most people (in the CP4E sense) are willing or capable of = doing. I recently made a Python CD-ROM for my nephew since he has no Internet = access at home. It was a lot of work gathering and assembling the = pieces and I was only able to include a fraction of what I had hoped due = to lack of time. I would LOVE to see someone sell a "Python EDU-SIG Resources CD" via = mail order. I think it would make a great school project (hint hint) = and could earn some extra money for the school. I'd love to see the = disc full of all the stuff that's been advertised on edu-sig - VPython, = Alice, PyGame, Jeff's book, Kirby's math stuff, etc., and I'd love to = see it constantly updated. Heck, I'd buy a subscription! I would hope something like this could sell for under $10 including S+H. = After all, the cost of materials and postage should be less than $1. = And I would hope the license would allow free duplication of the CD. = Teachers should be able to give a copy to every student in the class for = the cost of a CD-R blank and the time of a T/A. Thoughts? Or more importantly, volunteers? Brent Burley ------=_NextPart_000_0008_01C0E682.BCF3B8C0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Python is a very accessible (and very = capable)=20 language.  However, if you don't have Python on your system, it's = not very=20 accessible, and if you don't have an Internet connection, you're out of=20 luck.  Even if you have a broadband connection, you have a lot of = work=20 ahead of you, far more than most people (in the CP4E sense) are willing = or=20 capable of doing.
 
I recently made a Python CD-ROM for my = nephew since=20 he has no Internet access at home.  It was a lot of work gathering = and=20 assembling the pieces and I was only able to include a fraction of what = I had=20 hoped due to lack of time.
 
I would LOVE to see someone sell a = "Python EDU-SIG=20 Resources CD" via mail order.  I think it would make a great school = project=20 (hint hint) and could earn some extra money for the school.  I'd = love to=20 see the disc full of all the stuff that's been advertised on edu-sig - = VPython,=20 Alice, PyGame, Jeff's book, Kirby's math stuff, etc., and I'd love to = see it=20 constantly updated.  Heck, I'd buy a subscription!
 
I would hope something like this could = sell=20 for under $10 including S+H.  After all, the cost of=20 materials and postage should be less than $1.  And I would = hope the=20 license would allow free duplication of the CD.  Teachers should be = able to=20 give a copy to every student in the class for the cost of a CD-R blank = and the=20 time of a T/A.
 
Thoughts?  Or more importantly,=20 volunteers?
 
    Brent=20 Burley
------=_NextPart_000_0008_01C0E682.BCF3B8C0-- From rob@jam.rr.com Sun May 27 16:45:42 2001 From: rob@jam.rr.com (Rob Andrews) Date: Sun, 27 May 2001 10:45:42 -0500 Subject: [Edu-sig] Python accessibility References: <000b01c0e6bd$89f64740$b352d8ce@68k2f01> Message-ID: <3B112126.B1F6D49C@jam.rr.com> > Brent Burley and Pat Erb wrote: > > Python is a very accessible (and very capable) language. However, if > you don't have Python on your system, it's not very accessible, and if > you don't have an Internet connection, you're out of luck. Even if > you have a broadband connection, you have a lot of work ahead of you, > far more than most people (in the CP4E sense) are willing or capable > of doing. > > I recently made a Python CD-ROM for my nephew since he has no Internet > access at home. It was a lot of work gathering and assembling the > pieces and I was only able to include a fraction of what I had hoped > due to lack of time. > > I would LOVE to see someone sell a "Python EDU-SIG Resources CD" via > mail order. I think it would make a great school project (hint hint) > and could earn some extra money for the school. I'd love to see the > disc full of all the stuff that's been advertised on edu-sig - > VPython, Alice, PyGame, Jeff's book, Kirby's math stuff, etc., and I'd > love to see it constantly updated. Heck, I'd buy a subscription! > > I would hope something like this could sell for under $10 including > S+H. After all, the cost of materials and postage should be less than > $1. And I would hope the license would allow free duplication of the > CD. Teachers should be able to give a copy to every student in the > class for the cost of a CD-R blank and the time of a T/A. > > Thoughts? Or more importantly, volunteers? > > Brent Burley This should be simple enough. If people who think this is a good idea will post the items that should be included along with where they may be downloaded from, I'll see if I can get something together. I doubt it should cost as much as $10 per CD, because blank CDs are often less than $1/CD here if bought in bulk, which half of my friends do. Shipping on something that small shouldn't be terrible to most countries. If I were to do it, I doubt I'd charge anything at all to send a single CD out, even to another country. And the CD image can be made available for download from our web server, so that anyone with the capability to do so can download and burn their own copies. I'd have to convince my partner (who has the CD burner) to go along with it, but as long as he doesn't have to be the one who keeps the files up to date, he will probably find the idea agreeable. If he doesn't, I've been looking for a good reason to buy a burner for my own system. We could even throw on a current copy of the source code at Useless Python for students and teachers to play with. Rob Andrews -- Useless Python! It's the right thing to do. http://www.lowerstandard.com/python/pythonsource.html From pdx4d@teleport.com Sun May 27 17:10:51 2001 From: pdx4d@teleport.com (Kirby Urner) Date: Sun, 27 May 2001 09:10:51 -0700 Subject: [Edu-sig] Python accessibility In-Reply-To: <3B112126.B1F6D49C@jam.rr.com> References: <000b01c0e6bd$89f64740$b352d8ce@68k2f01> Message-ID: <3.0.3.32.20010527091051.014ae3fc@pop3.norton.antivirus> Another longer range concept would be to have a magazine called 'Python in Education' or something, which would include advertising. There could be a monthly CD you subscribe to. Authors would get paid for accepted articles and the code would go to the CD, which would be optional. Or some other configuration along these lines. There'd be a website with selected articles, but I'm actually thinking of something printed. With any new subscription including the optional CD, you'd mail out one of these "starter disks" with Python thereon. A challenge is the need for multiple platform support. A lot of schools use iMacs (my own brief experience with the iMac Python is that version of IDLE doesn't feature color-coding of key words). Some use RedHat RPMs, but Debian, for example, has an alternative distro system. Then you've got the Windows binaries. What most beginners would find oppressive, beyond getting a download off the net, is compiling source code. The idea is to provide unzip-and-run type install files. In my view, most 'Python in Education' articles would presume students were operating in IDLE. That's sort of "home base" for most presentations. Then you might have special features showing Python running in an X-term window or in Pythonwin, articles about programming the Gnome GUI with Python -- other platform-specific stuff. Each article could be labeled in the sidebar is to which versions of Python, and which OSes, were relevant to the article's contents. Kirby From matthias@rice.edu Sun May 27 17:38:51 2001 From: matthias@rice.edu (Matthias Felleisen) Date: Sun, 27 May 2001 11:38:51 -0500 (CDT) Subject: [Edu-sig] Re: Lisp vs Scheme vs Python In-Reply-To: (edu-sig-request@python.org) References: Message-ID: <200105271638.LAA12550@africa.cs.rice.edu> Kirby, your teacher understood Lisp and Lisp vs Python very well. He didn't understand Scheme and why recursive programming matters. Scheme and S-expressions: your teacher was clueless in that regard. Scheme, macros and do: You don't need to teach about macros to use looping constructs. You can use the ones that every Scheme provides (do) and introduce new ones for your students, if you believe it's best. Of course it isn't :-). Recursion: Read up on data types and how to specify them. Mathematically speaking (and that's what you want to do), there are basic sets subsets unions products inductive definitions (co-inductive definitions). That's it. Your basic functions in a program should match the data defs. The only way to match induction is to use recursion. The kind of recursion that you know (e.g. quicksort, fractals) has little to do with data. It's an algorithmic technique beyond basic programming. Loops are short-hands for linear recursions. But because there is an infinite way of doing linear mutual recursions among data defs, you can't get away with a finite number of looping constructs -- if you want to match data defs and program defs. You need recursion. Read HtDP (http://www.htdp.org). -- Matthias From erburley@ix.netcom.com Sun May 27 18:24:30 2001 From: erburley@ix.netcom.com (Brent Burley and Pat Erb) Date: Sun, 27 May 2001 10:24:30 -0700 Subject: [Edu-sig] Writing a web server Message-ID: <000b01c0e6d2$18e11a20$fd50d8ce@68k2f01> This is a multi-part message in MIME format. ------=_NextPart_000_0008_01C0E697.3715CE40 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit One of the things that is _really_ easy to do in Python is writing a web server. In fact, the standard distribution comes with a fully functioning server as an example. Find your lib directory and run SimpleHTTPServer.py directly and then open http://localhost:8000/ in your web browser. This web server provides a simple server-side file browser that can navigate directories and serve up html, graphics, and text files. This should work on most computers, including Windows, and you don't even need an Internet connection. Try it! I've attached an even simpler web server (16 lines of code) that is the web equivalent of "hello world". As simple as it is, it's complete enough that it shows everything you need to build a dynamic website. Just send "text/html" instead of "text/plain" and generate an html file dynamically in the do_GET method. The "self.path" variable contains the requested URL and can encode any information you want to pass between requests. How's this for a possible 9th/10th grade course: * Web Programming with Python - Students will program a fully-functioning website from scratch. Students will choose from building an interactive storybook where the reader influences the outcome of the story, or a web-community site with a message board and voting booth. No prior programming experience necessary. I think there are many advantages to this approach. For one thing, students can get immediate feedback through the web browser and can easily include graphics, sound, and simple user-interfaces via html forms. If the school allows the projects to be posted to a public server, then the students' work could be shown off to friends, relatives, and the world at large. This teaches directly marketable, real world skills and teaches programming as a means to an end. I also have an inkling (based on my niece and her friends) that this would appeal strongly to girls. Thoughts? Brent Burley ------=_NextPart_000_0008_01C0E697.3715CE40 Content-Type: text/plain; name="webserve.py" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="webserve.py" from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler class MyServerHandler(BaseHTTPRequestHandler): def do_HEAD(self): self.send_head() def do_GET(self): self.send_head() self.wfile.write("Hello, your request was: " + self.path) def send_head(self): self.send_response(200) self.send_header("Content-type", "text/plain") self.end_headers() server =3D HTTPServer(('', 8000), MyServerHandler) print "Web server running... direct your web browser to = http://localhost:8000/hello" server.serve_forever() ------=_NextPart_000_0008_01C0E697.3715CE40-- From jasonic@nomadicsltd.com Sun May 27 18:54:00 2001 From: jasonic@nomadicsltd.com (Jason Cunliffe) Date: Sun, 27 May 2001 13:54:00 -0400 Subject: [Edu-sig] Python accessibility References: <000b01c0e6bd$89f64740$b352d8ce@68k2f01> <3.0.3.32.20010527091051.014ae3fc@pop3.norton.antivirus> Message-ID: <005a01c0e6d6$036340c0$c3090740@megapathdsl.net> > Another longer range concept would be to have a magazine > called 'Python in Education' or something, which would > include advertising. There could be a monthly CD you > subscribe to. Authors would get paid for accepted > articles and the code would go to the CD, which would > be optional. Or some other configuration along these > lines. There'd be a website with selected articles, but > I'm actually thinking of something printed. With any > new subscription including the optional CD, you'd mail > out one of these "starter disks" with Python thereon. Kirby, Funny, I was just going to suggest this too! Print is great + CDROMs are too. They allow a consistent reference base to be easily and cheaply accessible. DrDobb's had a Python CDROM but has not been well maintained so less than useful. A well maintained series would be valuable resource for many people. I think monthly format is ok, but quarterly is honestly better as a base structure for Editorial and learning rhtythms. Journal have long folowed taht rhythm for good reason. Being dynamic, the web site absorbs the temporal and version offset between published 'editions'. Issues are thus quarterly [seasonal] digital/conceptual 'snapshots' of the Great Project... Encourages more a thematic approach to material beyond the regular hunter/gatherer skills. I suggest the Web site be planned using Zope: - Python-based - Free openSource and very cross-platform - well suited to web publishing - adapts well to collaborative site development - Offers chance to include a live CP4E 'web engine' for running code etc - easier to directly link and or 'embed' other web-based Python/CP4E work - transfer complex content in single .zexp binary or similar between CP4E systems. [CDROM can also use the same mechanism. Zope can even run direct from it] - People on EDU-SIG are working with it already There is now good swell of activity to create a wxPython-based ZopeIDE. As and when this project matures, it will be an excellent long-term foundation for CP4E. In effect it would be a rich 100% Python client interface for Zope. wxPython uses Scintilla [discussed in EDU-SIG recently], but also has many useful generic GUI tools and featuers. wxPython GRIDS for exampkle aer very nice. Can embed ACtiveX on Win32, and provide a consistent lanuch pad or wrapper environement for other standalone Python developments. In other words encourtages a modular open development blahblah.. Zope is very easy to install on Windows etc. A special CP4E CRDROM could thus include Zope using HTML for the all teh documentation and articles with Python code right there. Lots of great plugin's already for browsing, indesing, presenting file-based documentation, source code etc. Uploading many document types into Zope is very simple. There are also now some good tols for allowing indexing of the content of those. Articles writeen as MSWord or PDF can be indexed and meta_data stored in Zope or elsewhere. Zope runs nicely as a 'local' server. People tend to think of Web technology as only for the WEB. They often overlook the more fundamental features: widely accepted protocols and tools, hypertext, etc. CP4E which uses local server allows a good model for groups of people to work together locally [solo, sneakernet + over LAN], then share and aggregate their work remotely. This can of course be done more simply, using conventional tools, but the object architecture runs deep. I am believe one should always work 'In' the medium - whatever it is. > A challenge is the need for multiple platform support. > A lot of schools use iMacs (my own brief experience with > the iMac Python is that version of IDLE doesn't feature > color-coding of key words). Some use RedHat RPMs, but > Debian, for example, has an alternative distro system. > Then you've got the Windows binaries. What most beginners > would find oppressive, beyond getting a download off the > net, is compiling source code. The idea is to provide > unzip-and-run type install files. Yes Single click .exe type installation is very high priority. This is doable, not without some hassles, but very worth the effort. > In my view, most 'Python in Education' articles would > presume students were operating in IDLE. That's sort > of "home base" for most presentations. Then you might > have special features showing Python running in an > X-term window or in Pythonwin, articles about programming > the Gnome GUI with Python -- other platform-specific > stuff. Each article could be labeled in the sidebar is > to which versions of Python, and which OSes, were relevant > to the article's contents. In many cases obne can and should detect what is being used and adapt to it. That is another case for using 'local' CP4E Zope. it can detect and store state, handle various users [with granular permissions], but still launch special tools IDLE etc if you need/want to. I am not trying to complicate things by suggesting a Zope-based toolkit for CP4E. I realize theer is a risk it might complicate things. But it might simplfy things too! The 'natural' advantages seem very clear to me for CP4E collaborative CDROM Magazine WebSite publishing intitiative. Hope we can all work this out nicely together ... ./Jason From wilson@visi.com Sun May 27 19:27:49 2001 From: wilson@visi.com (Timothy Wilson) Date: Sun, 27 May 2001 13:27:49 -0500 (CDT) Subject: [Edu-sig] Python accessibility In-Reply-To: <000b01c0e6bd$89f64740$b352d8ce@68k2f01> Message-ID: On Sun, 27 May 2001, Brent Burley and Pat Erb wrote: > I would LOVE to see someone sell a "Python EDU-SIG Resources CD" via mail > order. I think it would make a great school project (hint hint) and could > earn some extra money for the school. I'd love to see the disc full of > all the stuff that's been advertised on edu-sig - VPython, Alice, PyGame, > Jeff's book, Kirby's math stuff, etc., and I'd love to see it constantly > updated. Heck, I'd buy a subscription! Good timing. I have a student who has been doing independent study with me this year. His final project has been to compile just such a CD. It includes the Python software, a number of the major 3rd part modules, VPython, PyGame, most of the common online tutorials and documentation, How to Think Like a Computer Scientist, and anything else we've been able to think of. I plan to hand out a copy of the CD to my Intro. to Comp. Prog. students in the fall. Then they can install the software at home and browse the documentation off the CD without tying up their parents' phone line. Our initial version should be ready within days. I will create an iso and a Web page listing the contents and make it available as soon as it's ready. We'd be happy to make modifications, add resources, etc. based on community input. -Tim -- Tim Wilson | Visit Sibley online: | Check out: Henry Sibley HS | http://www.isd197.org | http://www.zope.org W. St. Paul, MN | | http://slashdot.org wilson@visi.com | | http://linux.com From tim.one@home.com Sun May 27 20:44:09 2001 From: tim.one@home.com (Tim Peters) Date: Sun, 27 May 2001 15:44:09 -0400 Subject: [Edu-sig] Re: Lisp vs Scheme vs Python In-Reply-To: <200105271638.LAA12550@africa.cs.rice.edu> Message-ID: [Matthias Felleisen] > ... > Recursion: > Read up on data types and how to specify them. Mathematically > speaking (and that's what you want to do), there are > > basic sets > subsets > unions > products > inductive definitions > (co-inductive definitions). > > That's it. I'd add finite maps to the list, aka associative arrays ("dictionaries" in Python). Viewing a finite map as a subset of the product of the key and value sets isn't particularly illuminating, and especially not in a programming context. You can object that it's not "primitive", but then neither are products: in set theory products are defined in terms of ordered pairs, where ordered pairs are in turn defined in terms of unordered sets, the ordered pair (a, b) being (by definition) the set {{a}, {a, b}}. Since products are frequent in practice, that reduction is too tedious to endure every time, so we agree to pretend products are primitive in order to get on with life. Finite maps are also useful enough to merit (pseudo)primitive status. > Your basic functions in a program should match the data defs. The > only way to match induction is to use recursion. No argument, but I'll add that most lists in Python programs are better viewed as elements of product sets; e.g., if you've got a list of 5 names of things to buy at the store, I expect most non-Scheme programmers view that as being an element of the String**5 product space; *from* that view, indexing via ordinal position is natural, while traversing via recursion is as strained as viewing products as nested sets. They're both theoretically sound views (unless you want to disown products ). > ... > Loops are short-hands for linear recursions. Ya, and integer literals "are" short-hands for lambda compositions too. Demonstrating that a thing can be defined in terms of something more primitive doesn't make the case that the latter view is "more correct". Why not use a combinator-based language and give up the pesky concept of variable names too? If theoretical minimalism is a goal, a language like Joy makes Scheme look positively bloated with gratuitous pragmatic compromises: http://www.latrobe.edu.au/www/philosophy/phimvt/j00syn.html Now I happen to like gratuitous pragmatic compromises, and would much rather program in Scheme than in Joy. But if you want to cut to the heart of CompSci without "irrelevant" concerns about practicality or transparency getting in the way, Joy looks like a better bet (fewer primitive concepts: no vrbls, no formal parameters, no block structure, no iteration, and even lists "are" programs). > But because there is an infinite way of doing linear mutual > recursions among data defs, you can't get away with a finite > number of looping constructs -- if you want to match data defs > and program defs. You need recursion. Heartily agreed. Where Python parts company is in believing that *all* iteration is better expressed via recursion, and in particular iteration over lists. The notion that for element in list: do something with element is hard to explain in theory or practice doesn't hold water; OTOH, Python has no looping construct anywhere close to the complexity of Scheme's "do" macro (if you think iteration confuses students, it could be simply because you're teaching it via Scheme's bloated macro version! "for" in Python is tied to sequences, not arbitrarily large collections of initialization and rebinding and termination expressions). From pobrien@orbtech.com Mon May 28 00:42:43 2001 From: pobrien@orbtech.com (Patrick K. O'Brien) Date: Sun, 27 May 2001 18:42:43 -0500 Subject: [Edu-sig] Re: Lisp vs Scheme vs Python In-Reply-To: Message-ID: Wow. We're even getting polysyllabic pissing matches on the Edu list. Way cool. --- Patrick K. O'Brien Orbtech "I am, therefore I think." -----Original Message----- From: edu-sig-admin@python.org [mailto:edu-sig-admin@python.org]On Behalf Of Tim Peters Sent: Sunday, May 27, 2001 2:44 PM To: edu-sig@python.org Subject: RE: [Edu-sig] Re: Lisp vs Scheme vs Python [Matthias Felleisen] > ... > Recursion: > Read up on data types and how to specify them. Mathematically > speaking (and that's what you want to do), there are > > basic sets > subsets > unions > products > inductive definitions > (co-inductive definitions). > > That's it. I'd add finite maps to the list, aka associative arrays ("dictionaries" in Python). Viewing a finite map as a subset of the product of the key and value sets isn't particularly illuminating, and especially not in a programming context. You can object that it's not "primitive", but then neither are products: in set theory products are defined in terms of ordered pairs, where ordered pairs are in turn defined in terms of unordered sets, the ordered pair (a, b) being (by definition) the set {{a}, {a, b}}. Since products are frequent in practice, that reduction is too tedious to endure every time, so we agree to pretend products are primitive in order to get on with life. Finite maps are also useful enough to merit (pseudo)primitive status. From delza@alliances.org Mon May 28 05:35:35 2001 From: delza@alliances.org (Dethe Elza) Date: Sun, 27 May 2001 21:35:35 -0700 Subject: [Edu-sig] Python accessibility In-Reply-To: Message-ID: Tim, Is the CD window-only or is it cross-platform? -- Dethe Elza --- Chief Mad Scientist --- Burning Tiger Technologies "Oh, the jobs people work at! Out west, near Hawtch-Hawtch, there's a Hawtch-Hawtcher Bee-Watcher. His job is to watch... is to keep both his eyes on the lazy town bee. A bee that is watched will work harder, you see. Well...he watched and he watched. But, in spite of his watch, that bee didn't work any harder. Not mawtch. So then somebody said, 'Our old bee-watching man just isn't bee-watching as hard as he can. *He* ought to be watched by *another* Hawtch-Hawtcher! The thing that we need is a Bee-Watcher -Watcher!' Well... The Bee-Watcher-Watcher watched the Bee-Watcher. *He* didn't watch well. So another Hawtch-Hawtcher had to come in as a Watch-Watcher-Watcher! And today all the Hawtchers who live in Hawtch-Hawtch are watching on Watch-Watcher-Watchering-Watch, Watch- Watching the Watcher who's watching that bee. You're not a Hawtch-Watcher. You're lucky, you see." --Dr. Seuss, "Did I ever tell you how lucky you are?" > From: Timothy Wilson > Date: Sun, 27 May 2001 13:27:49 -0500 (CDT) > To: Brent Burley and Pat Erb > Cc: edu-sig@python.org > Subject: Re: [Edu-sig] Python accessibility > > On Sun, 27 May 2001, Brent Burley and Pat Erb wrote: > >> I would LOVE to see someone sell a "Python EDU-SIG Resources CD" via mail >> order. I think it would make a great school project (hint hint) and could >> earn some extra money for the school. I'd love to see the disc full of >> all the stuff that's been advertised on edu-sig - VPython, Alice, PyGame, >> Jeff's book, Kirby's math stuff, etc., and I'd love to see it constantly >> updated. Heck, I'd buy a subscription! > > Good timing. I have a student who has been doing independent study with me > this year. His final project has been to compile just such a CD. It includes > the Python software, a number of the major 3rd part modules, VPython, > PyGame, most of the common online tutorials and documentation, How to Think > Like a Computer Scientist, and anything else we've been able to think of. > > I plan to hand out a copy of the CD to my Intro. to Comp. Prog. students in > the fall. Then they can install the software at home and browse the > documentation off the CD without tying up their parents' phone line. > > Our initial version should be ready within days. I will create an iso and a > Web page listing the contents and make it available as soon as it's > ready. We'd be happy to make modifications, add resources, etc. based on > community input. > > -Tim > > -- > Tim Wilson | Visit Sibley online: | Check out: > Henry Sibley HS | http://www.isd197.org | http://www.zope.org > W. St. Paul, MN | | http://slashdot.org > wilson@visi.com | | http://linux.com > > > _______________________________________________ > Edu-sig mailing list > Edu-sig@python.org > http://mail.python.org/mailman/listinfo/edu-sig > From gritsch@iue.tuwien.ac.at Mon May 28 09:59:46 2001 From: gritsch@iue.tuwien.ac.at (Markus Gritsch) Date: Mon, 28 May 2001 10:59:46 +0200 Subject: [Edu-sig] Writing a web server References: <000b01c0e6d2$18e11a20$fd50d8ce@68k2f01> Message-ID: <3B121382.1AFB6F38@iue.tuwien.ac.at> Brent Burley and Pat Erb wrote: > One of the things that is _really_ easy to do in Python is writing a web > server. In fact, the standard distribution comes with a fully functioning > server as an example. Find your lib directory and run SimpleHTTPServer.py > directly and then open http://localhost:8000/ in your web browser. This web > server provides a simple server-side file browser that can navigate > directories and serve up html, graphics, and text files. This should work > on most computers, including Windows, and you don't even need an Internet > connection. Try it! > > I've attached an even simpler web server (16 lines of code) that is the web > equivalent of "hello world". As simple as it is, it's complete enough that > it shows everything you need to build a dynamic website. Just send > "text/html" instead of "text/plain" and generate an html file dynamically in > the do_GET method. The "self.path" variable contains the requested URL and > can encode any information you want to pass between requests. > > How's this for a possible 9th/10th grade course: > * Web Programming with Python - Students will program a fully-functioning > website from scratch. Students will choose from building an interactive > storybook where the reader influences the outcome of the story, or a > web-community site with a message board and voting booth. No prior > programming experience necessary. If you want to show how a simple Webserver can be written, your approach is fine. If you want to concentrate on programming dynamic content for Webpages, you could use http://webware.sourceforge.net/ http://webware.sourceforge.net/Webware/Docs/ This package is a very promising approach to use Python for developing dynamic served webpages without using ZOPE. It also contains a AsyncThreadedHTTPServer.py which makes it possible to use it without melting it with Apache. Enjoy, Markus From wilson@visi.com Mon May 28 13:15:55 2001 From: wilson@visi.com (Timothy Wilson) Date: Mon, 28 May 2001 07:15:55 -0500 (CDT) Subject: [Edu-sig] Python accessibility In-Reply-To: Message-ID: On Sun, 27 May 2001, Dethe Elza wrote: > Is the CD window-only or is it cross-platform? We're including software for all platforms. You browse the CD with your Web browser. Nothing fancy...yet . -Tim -- Tim Wilson | Visit Sibley online: | Check out: Henry Sibley HS | http://www.isd197.org | http://www.zope.org W. St. Paul, MN | | http://slashdot.org wilson@visi.com | | http://linux.com From matthias@rice.edu Mon May 28 14:07:15 2001 From: matthias@rice.edu (Matthias Felleisen) Date: Mon, 28 May 2001 08:07:15 -0500 (CDT) Subject: [Edu-sig] Re: Lisp vs Scheme vs Python In-Reply-To: (edu-sig-request@python.org) References: Message-ID: <200105281307.IAA12871@africa.cs.rice.edu> "Tim Peters" writes: I'd add finite maps to the list, aka associative arrays ("dictionaries" in Python). Viewing a finite map as a subset of the product of the key and value sets isn't particularly illuminating, and especially not in a programming context. Yes, finite maps and functions should be added to the constructors of the data definition list. Omitted by accident. But, on recursion vs iteration you don't seem to know much about Scheme: Heartily agreed. Where Python parts company is in believing that *all* iteration is better expressed via recursion, and in particular iteration over lists. The notion that for element in list: do something with element 1. Here is why this match that I am talking about matters: datatype list = null | cons of int * list ^ | | | ------------------------------ I am using ML notation to spec a datatype, and the backpointer shows the self-reference in the data definition. Now compare this to the function definition: f(some_list) = (cond [(null? some_list) ...] [(cons? some_list) ... (first some_list) ... f(rest(some_list))]) ^ | | | -------------------------------------------------------------- Number of function clauses: 2, because there are 2 clauses in the data def Selectors in second clause: 2, because there are 2 fields in the data def Recursion in the second clause: yes, because there is self-ref in the data def Recursion on the second selector: yes, because ... Now show me how to explain this with a for-loop. Now show me how to tell kids that all this generalizes to dd's with 10 clauses and 22 self-refs? 2. Scheme abstracts uniformly with lambda (Python doesn't). So, of course we teach that the same pattern for list-processing comes up over and over again. And then we show how to abstract: using map and for-each. From then on students understand that (for-each (lambda (element) (display element) (newline)) list-of-elements) is perfectly okay. But, they also understand how to abstract for a data def with 22 clauses and 10 self-references. 3. You write more stuff on reductionist view of programming. I didn't advertise a reductionist view. I said that one teaches matching of data defs and functions first, and then one moves on to abstractions. The reason is that students understand the why and learn to do things on their own rather than copy patterns and play monkey at the keyboard. Having said all that one can teach some of these things in Python of course. (If Python had abstracted in a uniform fashion, that would be easier of course.) Having said all that, I must admit that I don't think of R5RS but my own Scheme. -- Matthias From wrong@crosswinds.net Mon May 28 14:33:56 2001 From: wrong@crosswinds.net (charlie derr) Date: Mon, 28 May 2001 09:33:56 -0400 Subject: [Edu-sig] Python accessibility In-Reply-To: Message-ID: I have a couple suggestions for whoever is compiling this (or a future) CD. This of course assumes that all the space hasn't yet been used up. First, include all three versions of python (1.5.2, 2.0 and 2.1). Second, include Zope. Third, include lightflow (www.lightflowtech.com). Lightflow is not open-source, but i've found it a fascinating thing to play with, and the license states that you are free to use it for evaluation purposes as long as you are not using it for commercial gain. ~c +-----Original Message----- +From: edu-sig-admin@python.org [mailto:edu-sig-admin@python.org]On +Behalf Of Timothy Wilson +Sent: Monday, May 28, 2001 8:16 AM +To: Dethe Elza +Cc: Brent Burley and Pat Erb; edu-sig@python.org +Subject: Re: [Edu-sig] Python accessibility + + +On Sun, 27 May 2001, Dethe Elza wrote: + +> Is the CD window-only or is it cross-platform? + +We're including software for all platforms. You browse the CD with your Web +browser. Nothing fancy...yet . + +-Tim + +-- +Tim Wilson | Visit Sibley online: | Check out: +Henry Sibley HS | http://www.isd197.org | http://www.zope.org +W. St. Paul, MN | | http://slashdot.org +wilson@visi.com | | http://linux.com + + +_______________________________________________ +Edu-sig mailing list +Edu-sig@python.org +http://mail.python.org/mailman/listinfo/edu-sig + From pdx4d@teleport.com Mon May 28 17:51:03 2001 From: pdx4d@teleport.com (Kirby Urner) Date: Mon, 28 May 2001 09:51:03 -0700 Subject: [Edu-sig] Re: Lisp vs Scheme vs Python In-Reply-To: <200105271638.LAA12550@africa.cs.rice.edu> Message-ID: <000101c0e796$624566c0$0802a8c0@KirbyUrner> > That's it. Your basic functions in a program should match the data defs. > The only way to match induction is to use recursion. The kind of recursion > that you know (e.g. quicksort, fractals) has little to do with data. It's > an algorithmic technique beyond basic programming. So in these cases (quicksort and fractals) perhaps recursion is gratuitious, as it isn't justified by data defs. Certainly factorial (not fractals) is just as well implemented in Python with reduce(mul, range(1,n+1)) as with any recursive syntax. > Loops are short-hands for linear recursions. But because there is an > infinite way of doing linear mutual recursions among data defs, you can't > get away with a finite number of looping constructs -- if you want to match > data defs and program defs. You need recursion. > > Read HtDP (http://www.htdp.org). I'll check into it (have before but it's been some time -- very cool to have this book on the web). Another asset in the same category is: http://mitpress.mit.edu/sicp/full-text/book/book-Z-H-4.html -- also Scheme-heavy. On the other hand I don't think computer science should be too inward- looking. If my analogy is a conveyor belt, and/or things (objects) moving along through a channel (pipe), and each getting operations applied to it, then so be it. I don't require further theory to justify using this metaphor in a program. And in the cut'n paste from IDLE below, I vastly prefer loopit2. If theory says I should use loopit instead, then I say we should fix the theory. >>> def f(x): return x + 2 >>> f(3) 5 >>> mylist = range(15) >>> def loopit(f,mylist): if len(mylist)==0: return [] return [f(mylist[0])] + loopit(f,mylist[1:]) >>> loopit(f,mylist) [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16] >>> loopit(f,[]) [] >>> loopit(f,[1]) [3] >>> def loopit2(f,mylist): return map(f,mylist) >>> loopit2(f,mylist) [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16] >>> loopit2(f,[]) [] >>> loopit2(f,[1]) [3] Kirby From matthias@rice.edu Mon May 28 18:18:49 2001 From: matthias@rice.edu (Matthias Felleisen) Date: Mon, 28 May 2001 12:18:49 -0500 (CDT) Subject: [Edu-sig] Re: Lisp vs Scheme vs Python In-Reply-To: <000101c0e796$624566c0$0802a8c0@KirbyUrner> (pdx4d@teleport.com) References: <000101c0e796$624566c0$0802a8c0@KirbyUrner> Message-ID: <200105281718.MAA12943@africa.cs.rice.edu> No recursion is not gratuitous with quicksort and fractals. It's necessary there. Eliminating it means you manage your own stack, and I bet you're not as good at that as Guido. _Teaching_ recursion first, followed by abstraction (of which iterators are just one simple part) is not inward looking. It is _empowering_ programmers and _empowering_ people who wish to learn to think systematically. Of course I prefer (map (lambda (x) (* x 2)) (build-list 10 identity)) over whatever goble-dee-gook the recursive defs look like. But I thought this list was about teaching, empowering people with programming, and using programming to empower people to think (the way stupid old math used to do). -- Matthias From pdx4d@teleport.com Mon May 28 18:28:05 2001 From: pdx4d@teleport.com (Kirby Urner) Date: Mon, 28 May 2001 10:28:05 -0700 Subject: [Edu-sig] An intro without objects?? Message-ID: <3.0.3.32.20010528102805.0151ecf4@pop3.norton.antivirus> In the chapter entitled 'Building Abstractions with Data' in 'Structure and Interpretation of Computer Programs', the rational number object is introduced (Sec. 2.1.1.)... http://mitpress.mit.edu/sicp/full-text/book/book-Z-H-13.html ... except not as "objects", but in terms of procedures and data, with the data structure in question being the "pair" i.e. a (numerator, denominator) tuple, with relevant procedures for forming such pairs (cons) and extracting either (car, cdr). What you're left with is a sense of data on the one hand, and procedures for operating on that data on the other. I miss the higher level abstraction of "object", in which the relevant procedures are encapsulated, along with the data structure, such that our interface to the "rational number object" contains whatever functionality we like. Plus I miss the ability to easily override primitive operators, such that I can multiply, add, subtract rational numbers (a.k.a. fractions) using *, + - etc. This is an important abstraction in math -- to realize that these operators may be redefined at will (yet usually according to various rules of group theory, e.g. whatever * means, there should be an identity object ident such that anyobj * ident = anyobj = ident * anyobj). In the Python approach, we might begin in the "wishful thinking" stage by sketching out a shell object: class Rat: def __init__(self,p,q): self.numer = p self.denom = q def __add__(self,other): pass def __sub__(self,other): pass def __mul__(self,other): pass >>> a = Rat(2,3) >>> a.numer 2 >>> a.denom 3 and so on. We'll also want to have a way of representing rational numbers to the screen, along the lines of: (define (print-rat x) (newline) (display (numer x)) (display "/") (display (denom x))) i.e. def __repr__(self): return "%s/%s" % (self.numer,self.denom) >>> a = Rat(2,3) >>> a 2/3 And so on. I prefer this approach, because we're setting up a class definition, not a sandbox of procedures and data, with the procedures tied to the data simply by the programmer's knowledge and/or by documentation. The class definition is itself a kind of data structure, in that it files the relevant methods with the data, under the same heading. No one has to keep track of what procedures "belong" with what data. That's built in to the class definition. Furthermore, we're setting up an inheritable framework. A subclass could pick up where Rat leaves off, and further elaborate methods -- perhaps it would simply have a different representation scheme, outputting "mixed" fractions e.g. 5 1/4 instead of 25/4. This is commonly done with a global variable switch, but a subclass would work. In the case of Matrices, any ol' Matrix object would by nxm, with a subclass, Sqmatrix, being for nxn or square matrices -- where only these latter have certain methods, such as determinant and inverse. I guess I'm feeling uneasy with a foundational approach that doesn't bring in the concept of objects closer to the beginning. The object concept is an important one. Just procedures and data, without objects, seems a rather scattered/cluttered approach. Shouldn't newcomers learn the object model right about where this rational numbers example is presented? Certainly building rational numbers as objects would be a standard exercise in a Python-focused curriculum (might be a math class -- if the distinction matters). Kirby From pdx4d@teleport.com Mon May 28 18:54:42 2001 From: pdx4d@teleport.com (Kirby Urner) Date: Mon, 28 May 2001 10:54:42 -0700 Subject: [Edu-sig] Re: Lisp vs Scheme vs Python In-Reply-To: <200105281718.MAA12943@africa.cs.rice.edu> References: <000101c0e796$624566c0$0802a8c0@KirbyUrner> <000101c0e796$624566c0$0802a8c0@KirbyUrner> Message-ID: <3.0.3.32.20010528105442.01521dd8@pop3.norton.antivirus> At 12:18 PM 5/28/2001 -0500, Matthias Felleisen wrote: > >No recursion is not gratuitous with quicksort and fractals. It's necessary >there. Eliminating it means you manage your own stack, and I bet you're not >as good at that as Guido. Convenient with fractals, sure, but why necessary? What stack management? Just iterate by adding 1 and multiply the growing product until term = n. The model in mathematics, for fractals, is akin to SIGMA notation, except using the capital letter PI, which means multiply terms together vs. add them. So: n n! = PI j j=1 That's a "primitive definition" in a math textbook, and there's nothing recursive about it, any more than in: n tri(n) = SIGMA j j=1 i.e. the nth triangular number, also equal to n*(n+1)/2. >_Teaching_ recursion first, followed by abstraction (of which iterators are >just one simple part) is not inward looking. It is _empowering_ programmers >and _empowering_ people who wish to learn to think systematically. If all you have is a hammer, everything looks like a nail. I just don't want recursion to be the hammer. We have a variety of tools, of which recursion is one. It should be taught -- not sure about first though. By the time students get to programming, they probably already have experience with iterative, non-recursive processing, so it's already too late to teach recursion before anything else. >Of course I prefer > > (map (lambda (x) (* x 2)) (build-list 10 identity)) > >over whatever goble-dee-gook the recursive defs look like. But I thought >this list was about teaching, empowering people with programming, and using >programming to empower people to think (the way stupid old math used to >do). > >-- Matthias Yes, map(lambda x: x*2, range(10)) also works in Python. So if you prefer it, would you teach students to write it this way? I've suspicious of curricula in which the most "formally correct" way to do something is out of sync with the practical way of doing it. I'm not a huge fan of the Bourbaki school of thought, either, for much the same reason. Kirby From pdx4d@teleport.com Mon May 28 19:26:31 2001 From: pdx4d@teleport.com (Kirby Urner) Date: Mon, 28 May 2001 11:26:31 -0700 Subject: [Edu-sig] Re: Lisp vs Scheme vs Python In-Reply-To: <3.0.3.32.20010528105442.01521dd8@pop3.norton.antivirus> References: <200105281718.MAA12943@africa.cs.rice.edu> <000101c0e796$624566c0$0802a8c0@KirbyUrner> <000101c0e796$624566c0$0802a8c0@KirbyUrner> Message-ID: <3.0.3.32.20010528112631.0152d0d8@pop3.norton.antivirus> >Convenient with fractals, sure, but why necessary? What stack management? >Just iterate by adding 1 and multiply the growing product until >term = n. > >The model in mathematics, for fractals, is akin to SIGMA notation, >except using the capital letter PI, which means multiply terms >together vs. add them. So: Duh -- I wrote *fractal* and was thinking of *factorial* the whole time. Silly brain (knock knock -- wake up!). True enough, when I did my lsystems.py (not completely finished), recursion was key, e.g.: def iterate(n,axiom,rules): if n>0: axiom = produce(axiom,rules) print "Iteration count-down %s" % n return iterate(n-1,axiom,rules) else: return axiom So, re *factorial* (I should have said), there's no need to go the recursive route. Please make the appropriate substitutions. And now I understand what you meant by Guido and stack management -- yes, when using recursion, I rely on whatever language implementation to keep track of the process. Kirby From matthias@rice.edu Mon May 28 19:40:07 2001 From: matthias@rice.edu (Matthias Felleisen) Date: Mon, 28 May 2001 13:40:07 -0500 (CDT) Subject: [Edu-sig] Re: Lisp vs Scheme vs Python In-Reply-To: <3.0.3.32.20010528112631.0152d0d8@pop3.norton.antivirus> (message from Kirby Urner on Mon, 28 May 2001 11:26:31 -0700) References: <200105281718.MAA12943@africa.cs.rice.edu> <000101c0e796$624566c0$0802a8c0@KirbyUrner> <000101c0e796$624566c0$0802a8c0@KirbyUrner> <3.0.3.32.20010528112631.0152d0d8@pop3.norton.antivirus> Message-ID: <200105281840.NAA12976@africa.cs.rice.edu> And now I understand what you meant by Guido and stack management -- yes, when using recursion, I rely on whatever language implementation to keep track of the process. :-) [I knew you'd see the mistakes of your way eventually. And you also understand that "subtitution" leads to vacuous claims.] Of course, if lambda were to bind variables properly, you could always teach continuation-passing style and get away with closures, rather than stacks. Well, that's for PPython (or Parenthesized Python to do). And once kids understand that, nothing stands in their wau of generating interactive CGI scripts from interactive programs. (Hey, why not turn IDLE into an interactive CGI script that way?) -- Matthias From pdx4d@teleport.com Mon May 28 20:46:56 2001 From: pdx4d@teleport.com (Kirby Urner) Date: Mon, 28 May 2001 12:46:56 -0700 Subject: [Edu-sig] Re: Lisp vs Scheme vs Python In-Reply-To: <200105281840.NAA12976@africa.cs.rice.edu> References: <3.0.3.32.20010528112631.0152d0d8@pop3.norton.antivirus> <200105281718.MAA12943@africa.cs.rice.edu> <000101c0e796$624566c0$0802a8c0@KirbyUrner> <000101c0e796$624566c0$0802a8c0@KirbyUrner> <3.0.3.32.20010528112631.0152d0d8@pop3.norton.antivirus> Message-ID: <3.0.3.32.20010528124656.0153055c@pop3.norton.antivirus> At 01:40 PM 5/28/2001 -0500, Matthias Felleisen wrote: > > > And now I understand what you meant by Guido and stack management > -- yes, when using recursion, I rely on whatever language > implementation to keep track of the process. > >:-) [I knew you'd see the mistakes of your way eventually. And you also >understand that "subtitution" leads to vacuous claims.] Yes, I see. It's so obvious to me now. Kirby From tim.one@home.com Mon May 28 21:06:12 2001 From: tim.one@home.com (Tim Peters) Date: Mon, 28 May 2001 16:06:12 -0400 Subject: [Edu-sig] Re: Lisp vs Scheme vs Python In-Reply-To: <200105281307.IAA12871@africa.cs.rice.edu> Message-ID: [Matthias Felleisen] > Yes, finite maps and functions should be added to the constructors > of the data definition list. Omitted by accident. Ah -- great. I proceeded to go off the deep end reading extreme reductionist inclinations into the omission. Happy to drop all that. > But, on recursion vs iteration you don't seem to know much about Scheme: > > Heartily agreed. Where Python parts company is in believing that *all* > iteration is better expressed via recursion, and in particular iteration > over lists. The notion that > > for element in list: > do something with element > > > 1. Here is why this match that I am talking about matters: > > datatype list = null | cons of int * list > > ^ | > | | > ------------------------------ > > I am using ML notation to spec a datatype, and the backpointer > shows the self-reference in the data definition. Certainly *a* way to define a list of ints, and certainly the *natural* way provided you're using ML (or thinking in Scheme). Python is more from the Algol line, where "a sequence" is taken as primitive in its own right (see, e.g., C.A.R. Hoare's "Notes on data structuring"). A loop is the canonical way to process objects of sequence types, just as first/rest recursion is the canonical way to process a list in Scheme. The program structure matches the data structure in both, but since they view the data structure differently the program structures differ too. It's not the case that one is unprincipled. > Now compare this to the function definition: > > f(some_list) = (cond > [(null? some_list) ...] > [(cons? some_list) ... (first some_list) ... > f(rest(some_list))]) > ^ | > | | > -------------------------------------------------------------- > > Number of function clauses: 2, because there are 2 clauses in > the data def > Selectors in second clause: 2, because there are 2 fields in > the data def > Recursion in the second clause: yes, because there is self-ref > in the data def > Recursion on the second selector: yes, because ... > > Now show me how to explain this with a for-loop. A for loop isn't a natural way to process a list if you define a list inductively; it's natural for sequences. In a Haskell-ish type declaration system for Python it would look more like datatype intseq = [int] def f(some_intseq): for element in some_intseq: do something with the int "element" or datatype XXXseq = [XXX] def f(some_XXXseq): for element in some_XXXseq: do something with the XXX "element" > Now show me how to tell kids that all this generalizes to dd's > with 10 clauses and 22 self-refs? It doesn't, of course -- then you're outside the realm of sequence types. In the Algol line, such things are done via recursive datatypes (with or without explicit pointers; "without" in Python), using either "magic values" (like your "null" above) to terminate recursion, or a discriminated union. The structure of a recursive program matches the structure of a recursive datatype declaration closely there too, testing the special value or discriminator to decide which case obtains, and recursing on the recursive fields. Wirth's classic "Algorithms + Data Structures = Programs" is a fine text showing how to proceed systematically in such cases in Algol-like languages. > 2. Scheme abstracts uniformly with lambda (Python doesn't). So, of course > we teach that the same pattern for list-processing comes up over and > over again. And then we show how to abstract: using map and for-each. > > From then on students understand that > > (for-each (lambda (element) (display element) (newline)) > list-of-elements) > > is perfectly okay. How often do they use "map" instead by mistake ? I appreciate what you're saying, but don't think that, e.g., Kirby's students will suffer brain damage if they can write that for x in sequence: print x their first hour. You have to delay introducing lists in "How To Design Programs" for a long time, because you need to introduce most of Scheme's basic machinery first to be able to do anything interesting with them. > But, they also understand how to abstract for a data > def with 22 clauses and 10 self-references. I expect you're exaggerating there, yes? The difference bewteen one and two is significant to a newcomer, no matter how clear it is to an expert. But once they grasp two, I'll buy that the leap to 1000 is relatively easy. I appreciate that an inductively defined list is the easiest way to *start* this journey; in Python I'd do that by ignoring the built-in list type when the time comes and building a new list type via a Pair (Cons, whatever) class instead. > 3. You write more stuff on reductionist view of programming. I didn't > advertise a reductionist view. I said that one teaches matching of > data defs and functions first, and then one moves on to abstractions. I'm curious: I first learned Lisp in 1970, before any "decent" curriculum existed. The intimate connection between data structure and program structure is something I didn't see explicitly spelled out before Hoare's essay (mentioned above), and I learned it in practice via Pascal (and, indeed, from Wirth's book mentioned above). It occurred to me at the time that I would have had a harder time learning it in Lisp, because the Lisps I used didn't *have* a way to declare structured types: it was all pasted together by hand using fixed-size lists to represent structures and defining layers of macros to make it semi-readable. Scheme and Python also lack ways to "spell types", and you resorted to ML notation above while I resorted to Haskell. Does this lack get in the way? Or would using ML (or Haskell -- *something* with a carefully designed declaration system) to teach this approach have a real advantage? > The reason is that students understand the why and learn to do > things on their own rather than copy patterns and play monkey > at the keyboard. I expect that has more to do with the curriculum and the teacher than with the language. > Having said all that one can teach some of these things in Python of > course. (If Python had abstracted in a uniform fashion, that would be > easier of course.) Python's notion of sequence is too useful to give up. If you want an inductively defined list, you can build one and pretend sequences didn't exist. I'm not entirely sure what lesson that would teach in the end, though . > Having said all that, I must admit that I don't think of R5RS but my own > Scheme. Or Schemes? The language levels in DrScheme are a great idea! From tim.one@home.com Mon May 28 21:11:59 2001 From: tim.one@home.com (Tim Peters) Date: Mon, 28 May 2001 16:11:59 -0400 Subject: [Edu-sig] Re: Lisp vs Scheme vs Python In-Reply-To: <200105281718.MAA12943@africa.cs.rice.edu> Message-ID: [Matthias Felleisen] > No recursion is not gratuitous with quicksort and fractals. It's > necessary there. Eliminating it means you manage your own stack, and > I bet you're not as good at that as Guido. Guido is quite fond of recursion -- the Python implementation is full of it (a statement you may agree with under an unintended reading ). From tim.one@home.com Mon May 28 21:23:28 2001 From: tim.one@home.com (Tim Peters) Date: Mon, 28 May 2001 16:23:28 -0400 Subject: [Edu-sig] Re: Lisp vs Scheme vs Python In-Reply-To: <3.0.3.32.20010528105442.01521dd8@pop3.norton.antivirus> Message-ID: [Kirby Urner, to Matthias] > Yes, map(lambda x: x*2, range(10)) also works in Python. > > So if you prefer it, would you teach students to write it this > way? I'm sure he does, but not at first: if you view lists as inductively defined recursive data structures (which he does), then you really need to teach what all those big words *mean* first. Then map is a simple application of those ideas, and students can implement it themselves with full confidence in what they're doing. Once they reach that stage, cool, just use "map" directly. Python views lists as sequences instead, and is more concerned about making operations transparent "at a glance" than in building them from the ground up. From that view, in current Python the preferred way to write the above is [x**2 for x in range(10)] a variant of set-builder notation borrowed from SETL via Haskell. > I've suspicious of curricula in which the most "formally correct" way > to do something is out of sync with the practical way of doing it. There's nothing formally suspect about "map" in Python or Scheme -- although, strictly speaking, Scheme's "map" doesn't define the order in which the function is applied, so there's a bunch of artificial complexity there catering to optimized implementations. Python doesn't have anything like that: every Python expression is exactly as slow as it looks . From pdx4d@teleport.com Mon May 28 22:34:30 2001 From: pdx4d@teleport.com (Kirby Urner) Date: Mon, 28 May 2001 14:34:30 -0700 Subject: [Edu-sig] Speaking of factorials... Message-ID: <3.0.3.32.20010528143430.015309d8@pop3.norton.antivirus> While we're on the subject, I just wanted to go over something about the combination function, defined as n! combo(n,k) = -------- k!(n-k)! You find this guy all over in math. You can use it to derive the kth term in row n of Pascal's [famous] Triangle for example. Citations: http://www.mathforum.com/epigone/math-learn/zulphingyee/ http://www.mathforum.com/epigone/math-learn/snoipumkhee/ But it's wasteful to implement this expression literally, without interpretation. Terms on the bottom inevitably cancel with terms on the top, so you end up "throwing away" some of the multiplications -- so why do 'em in the first place? For example, consider combo(10,4) = 1*2*3*4*5*6*7*8*9*10 -------------------- 1*2*3*4 * 1*2*3*4*5*6 You can use either the k! or the (n-k)! to cancel multiplications in the numerator. One should take one's pick and do so, rather than carry out all multiplications both above and below. Using Guido's little timer guy from his excellent essay at http://www.python.org/doc/essays/list2str.html (scroll down), we can test the relative efficacy if canceling (goodcombo), vis ignoring the opportunity (badcombo): >>> def goodcombo(n,k): return reduce(mul,range(n,n-k,-1))/reduce(mul,range(1,k+1)) >>> def badcombo(n,k): return (reduce(mul,range(1,n+1))/ (reduce(mul,range(1,k+1))*reduce(mul,range(1,n-k+1)))) >>> import time >>> def timing(f, n, a, b): print f.__name__, r = range(n) t1 = time.clock() for i in r: f(a,b); f(a,b); f(a,b); f(a,b); f(a,b); f(a,b) f(a,b); f(a,b); f(a,b); f(a,b) t2 = time.clock() print round(t2-t1, 3) >>> timing(goodcombo,500,10,6) goodcomb 0.275 >>> timing(badcombo,500,11,6) badcomb 0.453 I rest my case. You'll frequently find variants of badchoice in Python modules, e.g. here in in Robert Kern's totally awesome and way cool clifford.py at http://starship.python.net/crew/kernr/source/clifford.py def comb(n, k): """\ Returns /n\\ \\k/ comb(n, k) --> PyInt """ def fact(n): return Numeric.multiply.reduce(range(1, n+1)) return fact(n) / (fact(k) * fact(n-k)) Easier to read, maybe, but not faster to run. Speaking of Clifford Algebra, that's the next big thing in geometric algebra (GA) these days and finding a way to bring GA to secondary schools is a front lines curriculum writing challenge. Maybe Python can help, as per this post to a Community Colleges list (one of mine, of yesterday): http://www.mathforum.com/epigone/mathedcc/lorswinbleh Kirby From tim.one@home.com Tue May 29 00:01:35 2001 From: tim.one@home.com (Tim Peters) Date: Mon, 28 May 2001 19:01:35 -0400 Subject: [Edu-sig] Speaking of factorials... In-Reply-To: <3.0.3.32.20010528143430.015309d8@pop3.norton.antivirus> Message-ID: [Kirby Urner] > While we're on the subject, I just wanted to go over > something about the combination function, defined as > > n! > combo(n,k) = -------- > k!(n-k)! > ... > But it's wasteful to implement this expression literally, > ... > Using Guido's little timer guy from his excellent essay at > http://www.python.org/doc/essays/list2str.html (scroll down), > we can test the relative efficacy if canceling (goodcombo), > vis ignoring the opportunity (badcombo): > > >>> def goodcombo(n,k): > return reduce(mul,range(n,n-k,-1))/reduce(mul,range(1,k+1)) > > >>> def badcombo(n,k): > return (reduce(mul,range(1,n+1))/ > (reduce(mul,range(1,k+1))*reduce(mul,range(1,n-k+1)))) Oh, Kirby, you have got to get over your unhealthy fascination with reduce . Seriously, this code is unreadable. Python is supposed to be pretty! Here's a tease: goodcombo 1.506 badcombo 1.659 shortcomb 0.615 "shortcomb" is shown later. No reduce. > I rest my case. Ditto . > >>> timing(goodcombo,500,10,6) > goodcomb 0.275 > >>> timing(badcombo,500,11,6) > badcomb 0.453 Given the way goodcombo and badcombo work, passing 10,6 to goodcombo but 11,6 to badcombo gave goodcombo an unfair advantage. Here's the reduce-free shortcomb: def shortcomb(m, n): """m, n -> number of combinations of m items, n at a time. m >= n >= 0 required. Doesn't check its arguments. Assumes nothing will overflow -- tough luck if it does. """ if n > (m >> 1): n = m-n if n == 0: return 1 result = m i = 2 m, n = m-1, n-1 while n: # assert (result * m) % i == 0 result = result * m / i i += 1 n -= 1 m -= 1 return result Timing was done via timing(goodcombo, 5000, 11, 6) timing(badcombo, 5000, 11, 6) timing(shortcomb, 5000, 11, 6) Now in practice I don't use shortcomb either, for reasons you might be able to guess from the snotty comments I put in its docstring . Here's the version I actually use, and heartily recommend it. It's slower than badcombo! But it complains if you feed it bad arguments, and uses bigint arithmetic so that overflow isn't a concern (which, btw, is the real reason it's slower): def _chop(n): """n -> int if it fits, else long.""" try: return int(n) except OverflowError: return n def comb(m, n): """m, n -> number of combinations of m items, n at a time. m >= n >= 0 required. """ if not m >= n >= 0: raise ValueError("m >= n >= 0 required: " + `m, n`) if n > (m >> 1): n = m-n if n == 0: return 1 result = long(m) i = 2 m, n = m-1, n-1 while n: # assert (result * m) % i == 0 result = result * m / i i += 1 n -= 1 m -= 1 return _chop(result) Even shortcomb is less prone to spurious overflows than goodcombo or badcombo, though, because it divides out each part of the denominator just as soon as it's certain the numerator is divisible by it: >>> badcombo(52, 7) Traceback (most recent call last): File "", line 1, in ? File "timecomb.py", line 60, in badcombo return (reduce(mul,range(1,n+1))/ OverflowError: integer multiplication >>> goodcombo(52, 7) Traceback (most recent call last): File "", line 1, in ? File "timecomb.py", line 57, in goodcombo return reduce(mul,range(n,n-k,-1))/reduce(mul,range(1,k+1)) OverflowError: integer multiplication >>> shortcomb(52, 7) 133784560 >>> From wilson@visi.com Tue May 29 01:40:22 2001 From: wilson@visi.com (Timothy Wilson) Date: Mon, 28 May 2001 19:40:22 -0500 (CDT) Subject: [Edu-sig] text compression as a learning tool Message-ID: Hi everyone, I'm trying to come up with some more comprehensive projects to supplement my Python class for next fall. I'm definitely going to do a little "clubhouse crypto" (thanks Kirby and Neal Stephenson for picquing my interest). Before undertaking my own study of text/data compression, I'd like to get the opinions of the list members here about whether you think this could be an appropriate subject for beginning to intermediate Python programmers. Any particular references to compression algorithms or other background materials? Other thoughts? -Tim -- Tim Wilson | Visit Sibley online: | Check out: Henry Sibley HS | http://www.isd197.org | http://www.zope.org W. St. Paul, MN | | http://slashdot.org wilson@visi.com | | http://linux.com From pdx4d@teleport.com Tue May 29 01:44:53 2001 From: pdx4d@teleport.com (Kirby Urner) Date: Mon, 28 May 2001 17:44:53 -0700 Subject: [Edu-sig] Speaking of factorials... In-Reply-To: References: <3.0.3.32.20010528143430.015309d8@pop3.norton.antivirus> Message-ID: <3.0.3.32.20010528174453.0153bab8@pop3.norton.antivirus> >Oh, Kirby, you have got to get over your unhealthy fascination with reduce >. It's a phase, like puberty. >Seriously, this code is unreadable. Python is supposed to be >pretty! Here's a tease: >goodcombo 1.506 >badcombo 1.659 >shortcomb 0.615 >timing(goodcombo, 5000, 11, 6) >timing(badcombo, 5000, 11, 6) >timing(shortcomb, 5000, 11, 6) Oooo, fast machine. Tomorrow I upgrade from this AMD 400 Mhz to a 1.2 Mhz AMD Thunderbird -- will retest for kicks. But then, this is Windows. Don't tell me you're on a 386. > Given the way goodcombo and badcombo work, passing 10,6 to > goodcombo but 11,6 to badcombo gave goodcombo an unfair advantage. That was an error, to stack the deck like that. goodcombo is still faster than badcombo though. Here's another version of goodcombo: def goodcombo(n,k): """ Returns n!/k!(n-k)! where n>=k """ numer = reduce(mul,[1L]+range(n-k+1,n+1)) return numer/reduce(mul,[1L]+range(2,k+1)) Works with long ints, but still slower than yours, and no parameter checking. I see now that ending with that fatso division is less efficient than your "divide as you go" strategy. >>> timing(goodchoice2,5000,52,7) goodchoice2 7.037 >>> timing(comb,5000,52,7) comb 5.699 comb is well-designed. Like your _chop method too -- great stuff! Thank you Guru Peters. Kirby From jasonic@panix.com Tue May 29 05:21:52 2001 From: jasonic@panix.com (Jason Cunliffe) Date: Mon, 28 May 2001 21:21:52 -0700 Subject: [Edu-sig] text compression as a learning tool References: Message-ID: <001901c0e7f6$e3746100$cc090740@megapathdsl.net> Not what you are asking for and it's not crypto.. There is a cool Python API for WordNet - fascinatating in its own right and could open up a different kind of crypto based on larger granularity of text chunks, meanings and associations. It might be challenging and enlightening to deal programatically with the English language while learning to speak and think in the Python language. http://www.cs.brandeis.edu/~steele/sources/wordnet-python.html The wordnet.py module is a Python interface to the Wordnet 1.6 database. WordNet is a database of word meanings and lexical relationships, such as synonym, antonym, hypernym ("poodle"->"dog"), and hyponym ("poodle"->"dog"). wordnet.py presents a concise interface to WordNet, that allows the user to type expressions such as N['dog'], hyponyms(N['dog'][0]), and closure(ADJ['red'], SYNONYM) to query the database. ./Jason ----- Original Message ----- From: "Timothy Wilson" To: "Python-Edu SIG" Sent: Monday, May 28, 2001 5:40 PM Subject: [Edu-sig] text compression as a learning tool > Hi everyone, > > I'm trying to come up with some more comprehensive projects to supplement my > Python class for next fall. I'm definitely going to do a little "clubhouse > crypto" (thanks Kirby and Neal Stephenson for picquing my interest). > > Before undertaking my own study of text/data compression, I'd like to get > the opinions of the list members here about whether you think this could be > an appropriate subject for beginning to intermediate Python programmers. > > Any particular references to compression algorithms or other background > materials? > > Other thoughts? > > -Tim > > -- > Tim Wilson | Visit Sibley online: | Check out: > Henry Sibley HS | http://www.isd197.org | http://www.zope.org > W. St. Paul, MN | | http://slashdot.org > wilson@visi.com | | http://linux.com > > > _______________________________________________ > Edu-sig mailing list > Edu-sig@python.org > http://mail.python.org/mailman/listinfo/edu-sig > From schoen@loyalty.org Tue May 29 02:18:19 2001 From: schoen@loyalty.org (Seth David Schoen) Date: Mon, 28 May 2001 18:18:19 -0700 Subject: [Edu-sig] text compression as a learning tool In-Reply-To: ; from wilson@visi.com on Mon, May 28, 2001 at 07:40:22PM -0500 References: Message-ID: <20010528181819.J10716@zork.net> Timothy Wilson writes: > Hi everyone, > > I'm trying to come up with some more comprehensive projects to supplement my > Python class for next fall. I'm definitely going to do a little "clubhouse > crypto" (thanks Kirby and Neal Stephenson for picquing my interest). > > Before undertaking my own study of text/data compression, I'd like to get > the opinions of the list members here about whether you think this could be > an appropriate subject for beginning to intermediate Python programmers. > > Any particular references to compression algorithms or other background > materials? I fondly remember inventing run-length encoding in junior high, so it occurs to me that that's a good algorithm to work with. RLE doesn't usually work much on text (since letters are rarely repeated in natural languages in groups larger than two), but it's great for graphics. Have you considered presenting the problem of compressing pictures? If a picture is in an array, how can it be written to a file in such a way that the file can be read back in and the array reconstructed? There is an "obvious" way with two nested loops, and if students can understand that, maybe they can think of alternatives (of which the simplest is RLE). Then the problem is which of these alternatives typically produce shorter files than the "obvious" technique. I think RLE is given as an exercise in _SICP_, but the book explains how it works and then simply asks you to implement it. Is it possible that, if you mention the problem, some student will just think of RLE or some similar technique? For text compression, you can look at digraph frequencies and trigraph frequencies, or word frequencies. Many early commercial compression applications from the age of the telegraph were not automated, but were performed by humans using codebooks. There's a lot of literature about this recently -- a few of the popular recent books on cryptography discuss this. The codes were not _necessarily_ meant to provide confidentiality, but they'd abbreviate common words. Then you have to think about something like a quoting mechanism if you want to retain the ability to express the abbreviations themselves. (Perhaps that gets into a discussion of lossy versus lossless compression: a system which can't reverse certain abbreviations -- for example, which compresses several different synonyms into the same code -- will be lossy because it can't restore the literal original text. But it could still be useful.) I think there was some material about those commercial codes in the very interesting book _The Victorian Internet_ by Tom Standage. Compression really got a huge boost from the telegraph because of how expensive it could be to transit large quantities of information. (On the other hand, the use of abbreviations is much older, and medieval manuscripts are chock full of standardized abbreviations, including many which have fallen into disuse now.) So you could certainly approach text compression from the word level by starting with word frequency counters. (Those are super-easy with Python dictionaries!) And people can absolutely get useful compression by these methods. Unfortunately, a lot of recent highly-efficient techniques are relatively difficult to understand. I think Huffman coding is often thought of as the boundary between the elementary and the intricate. You can probably _explain_ Huffman coding in a straightforward way, but I doubt you can expect students to discover it for themselves. Unfortunately, beyond Huffman coding, I've usually seen techniques presented in a "cookbook" way -- you know, here is a formal description of this algorithm, but "you are not expected to understand this". This is true for presentations of LZ and LZW I've seen. (Is it a bad idea to mention the issues around the LZW patent?) There is a book about data compression called _The Data Compression Book_ which has code for some modern algorithms in C, and I seem to remember that it has a big bibliography. http://dogma.net/markn/tdcb/tdcb.htm You can also study the bzip algorithm: http://www.bk.isy.liu.se/~svan/bwt/ The biggest open question for me is not whether this is a good area to present to students -- I think it's a _great_ area to present to students -- but to what extent you can expect them to develop their own techniques. I can imagine lots of great exercises, but it's equally easy to imagine a student coming back and saying "I have absolutely no idea how to start here". Important points: - What different techniques work for different kinds of files? - Is there a technique that works for every "kind of file"? - What do we mean by a "kind of file"? How can a computer tell them apart? How would a person tell them apart? - Why are some techniques more effective in particular situations? - Is there a limit to how effective a compression technique can be? How good would the best imaginable technique be? - Is there a compression technique which can compress any file? - Is there such a thing as data that can't be compressed? It might be worth keeping in mind that algorithmic information theory, which deals with the implications of the final question, was originally discovered by a (then) high school student (Gregory J. Chaitin). The connection between compression and Chaitin's work (which actually leads to things like generalizations of Godel's theorems!) is very exciting. See Chaitin's home page: http://www.umcs.maine.edu/~chaitin/ -- Seth David Schoen | And do not say, I will study when I Temp. http://www.loyalty.org/~schoen/ | have leisure; for perhaps you will down: http://www.loyalty.org/ (CAF) | not have leisure. -- Pirke Avot 2:5 From dyoo@hkn.eecs.berkeley.edu Tue May 29 02:20:32 2001 From: dyoo@hkn.eecs.berkeley.edu (Daniel Yoo) Date: Mon, 28 May 2001 18:20:32 -0700 (PDT) Subject: [Edu-sig] text compression as a learning tool In-Reply-To: Message-ID: On Mon, 28 May 2001, Timothy Wilson wrote: > I'm trying to come up with some more comprehensive projects to supplement my > Python class for next fall. I'm definitely going to do a little "clubhouse > crypto" (thanks Kirby and Neal Stephenson for picquing my interest). > > Before undertaking my own study of text/data compression, I'd like to get > the opinions of the list members here about whether you think this could be > an appropriate subject for beginning to intermediate Python programmers. This sounds like a really fun subject! Yes, it sounds very appropriate. I've written a small module to implement the Sandorf cypher, which is pretty fun to play with. The Sandorf cypher description is here: http://acm.uva.es/p/v7/795.html and this code: http://www.lowerstandard.com/python/sandorf.py implements the encryption and decryption routines. > Any particular references to compression algorithms or other background > materials? You may find this page useful: http://www.cs.sfu.ca/cs/CC/365/li/squeeze/ This page gives tutorials on lossless compression, including stuff on huffman encoding and lzw. Another fun project might be to implement run-length encoding on black and white icons. From wilson@visi.com Tue May 29 02:58:55 2001 From: wilson@visi.com (Timothy Wilson) Date: Mon, 28 May 2001 20:58:55 -0500 (CDT) Subject: [Edu-sig] text compression as a learning tool In-Reply-To: <20010528181819.J10716@zork.net> Message-ID: On Mon, 28 May 2001, Seth David Schoen wrote: > I fondly remember inventing run-length encoding in junior high, so it > occurs to me that that's a good algorithm to work with. That reminds me of all the things I "invented" as a kid that I soon discovered had been previously invented. I was so close to fame and riches. :-) -Tim -- Tim Wilson | Visit Sibley online: | Check out: Henry Sibley HS | http://www.isd197.org | http://www.zope.org W. St. Paul, MN | | http://slashdot.org wilson@visi.com | | http://linux.com From schoen@loyalty.org Tue May 29 03:19:09 2001 From: schoen@loyalty.org (Seth David Schoen) Date: Mon, 28 May 2001 19:19:09 -0700 Subject: [Edu-sig] text compression as a learning tool In-Reply-To: ; from wilson@visi.com on Mon, May 28, 2001 at 08:58:55PM -0500 References: <20010528181819.J10716@zork.net> Message-ID: <20010528191909.K10716@zork.net> Timothy Wilson writes: > On Mon, 28 May 2001, Seth David Schoen wrote: > > > I fondly remember inventing run-length encoding in junior high, so it > > occurs to me that that's a good algorithm to work with. > > That reminds me of all the things I "invented" as a kid that I soon > discovered had been previously invented. I was so close to fame and > riches. :-) Bill Gosper, the genius and accomplished hacker, gave a great interview where he expressed this amusing jealousy for Euler, who had the good fortune to have been born first. Donald J. Albers et al., _More Mathematical People_, p. 106. Great book. There's also the comment that St. Jerome recounted about Aelius Donatus: "Pereant," inquit, "qui ante nos nostra dixerunt." ("May they perish," [Aelius Donatus] said, "who have said our own things before us!") -- Seth David Schoen | And do not say, I will study when I Temp. http://www.loyalty.org/~schoen/ | have leisure; for perhaps you will down: http://www.loyalty.org/ (CAF) | not have leisure. -- Pirke Avot 2:5 From tim.one@home.com Tue May 29 05:57:28 2001 From: tim.one@home.com (Tim Peters) Date: Tue, 29 May 2001 00:57:28 -0400 Subject: [Edu-sig] Speaking of factorials... In-Reply-To: <3.0.3.32.20010528174453.0153bab8@pop3.norton.antivirus> Message-ID: [Kirby Urner] > ... > Oooo, fast machine. 866 Pentium -- a bit behind the times. But I'm running what will eventually become Python 2.2, and it's a bit faster than 2.1. > Tomorrow I upgrade from this AMD 400 Mhz to a 1.2 Mhz AMD Thunderbird -- Cool! Especially if you meant GHz . > will retest for kicks. But then, this is Windows. Oh, same here -- Win98SE. It's a pain for development work (& trying to time things on it reliably is almost hopeless), but it keeps me much more sympathetic to my sisters and the majority of Python's new users than I would be otherwise. Now I can dismiss complaints with *empathy* . > ... > Here's another version of goodcombo: > > def goodcombo(n,k): > """ > Returns n!/k!(n-k)! where n>=k > """ > numer = reduce(mul,[1L]+range(n-k+1,n+1)) > return numer/reduce(mul,[1L]+range(2,k+1)) > > Works with long ints, but still slower than yours, and no > parameter checking. I see now that ending with that fatso > division is less efficient than your "divide as you go" > strategy. That's especially true when working with long ints, and you already know why! Here's a big int: 29837498239837948798274982794283749383279384 Forget computers for a moment: would *you* rather divide that by 7, or by 3489798? Python too. The routine to divide by "a digit" is much simpler than the routine to divide by "a whole bunch of digits". Sophisticated bigint packages don't care so much, but Python's was written for correctness and portability rather than for peak speed. BTW, "a digit" in the bigint internals is actually in range(2**15), so Python is as happy to divide by 27777 as by 7. Go over that boundary, though, and speed takes a hit. The comb() routine first divides by 2, then by 3, etc, so in practice never needs to do "a fancy" division. When you're working with small ints, though, the hardware is doing the division and it doesn't care so much. If you time it, you'll often find that reduce() is slower than an equivalent loop. > ... > comb is well-designed. Thanks! It was part of an Industrial Package, so it had to be . > Like your _chop method too -- great stuff! Scheme has it all over Python there: it's a PITA that Python has more than one flavor of int! We're slowly moving toward eradicating the user-visible difference. It's slow going, though, because it's hard to do it in a way that's 100% backward compatible; sooner or later I'm afraid we're going to have to break some old code. From matthias@rice.edu Tue May 29 13:43:13 2001 From: matthias@rice.edu (Matthias Felleisen) Date: Tue, 29 May 2001 07:43:13 -0500 (CDT) Subject: [Edu-sig] foundations, In-Reply-To: (edu-sig-request@python.org) References: Message-ID: <200105291243.HAA13253@africa.cs.rice.edu> Kirby writes: I guess I'm feeling uneasy with a foundational approach that doesn't bring in the concept of objects closer to the beginning. The object concept is an important one. Just procedures and data, without objects, seems a rather scattered/cluttered approach. Shouldn't newcomers learn the object model right about where this rational numbers example is presented? Certainly building rational numbers as objects would be a standard exercise in a Python-focused curriculum (might be a math class -- if the distinction matters). You need to distinguish several things: - class-based programming & object-oriented computation - object-oriented programming & object-oriented computation - modules and representation hiding Functional programmers prefer modules over classes. In PLT Scheme we use both. The idea is simple. You write a module and you export just as much as you wish. For example, (define-signature Sequence^ ( build-sequence ; Element ... Element -> Sequence iterator ; Sequence (Element -> X) -> Void )) (define Sequence@ (unit/sig (Sequence^) (import ...) ; imports ; ------------------------------------------------------- ; body (define-struct hide (>sequence)) ; a structure for encapsulating stuff (define (build-sequence . x) (make-hide ... x ...)) (define (iterator sequence function) (let ([internal-representation (hide->sequence sequence)]) ...)))) defines a module that creates an opaque type sequence by exporting constructor and an iterator but no tools to get at the internal representation. In other words, it is a mechanism for coupling data and functions in an intimate manner (and units are first-class values on top). It looks even better if you write this with ML signatures: signature GROUP = sig type Element val plus : Element Element -> Element val id : Element val inv : Element -> Element end functor Group(type E) : GROUP = struct type Element = E; ... end and you can parameterize functors and units over imported mathematical structures: functor VectorSpace(structure Field) : VECTORSPACE = struct ... end and then you can use Real or Complex or some other field to build vector spaces. -- Matthias P.S. Someone asked whether I'd use ML first. No. Kids have enough trouble understanding computation. Type checking and proves are confusing them even more. From pdx4d@teleport.com Tue May 29 16:37:38 2001 From: pdx4d@teleport.com (Kirby Urner) Date: Tue, 29 May 2001 08:37:38 -0700 Subject: [Edu-sig] foundations, In-Reply-To: <200105291243.HAA13253@africa.cs.rice.edu> References: Message-ID: <3.0.3.32.20010529083738.0161fbac@pop3.norton.antivirus> I'm glad to know there's a module system of such sophistication. Also, whereas the chapter I was citing introduces the rational number by means of numerous Scheme procedures, it wouldn't make a lot of sense to go to all this trouble in PLT Scheme, where the fraction type is built in, e.g.: > (define a (/ 3 4)) > a 3/4 > (define b (/ 1 12)) > (+ a b ) 5/6 > (- a b) 2/3 > (* a b) 1/16 > (/ a b) 9 In Python, I'd do the same re modules: store the Fraction class in a module, then import. I happen to have one handy: >>> from mathobjects import Fraction modules bear some resemblance to classes in that both use the dictionary structure to define a table of contents. You can get at the keys to a class with dir: >>> dir(Fraction) ['__abs__', '__add__', '__div__', '__doc__', '__eq__', '__float__', '__gt__', '__init__', '__lt__', '__module__', '__mul__', '__neg__', '__pow__', '__radd__', '__rdiv__', '__repr__', '__rmul__', '__sub__', 'denom', 'fformat', 'float', 'list', 'mkfract', 'numer', 'recip', 'simplify'] Same with a module: >>> import mathobjects >>> dir(mathobjects) ['Fraction', 'Matrix', 'Poly', 'Sqmatrix', '__builtins__', '__doc__', '__file__', '__name__', '__path__', 'deriv', 'polynomial', 'pyfraction', 'simplematrix'] Then use the Fraction class to instantiate objects, a and b. Because the primitive operators have been overridden, your fraction objects behave as expected: >>> a = Fraction(3,4) >>> b = Fraction(1,12) >>> a+b (5/6.) >>> a-b (2/3.) >>> a*b (1/16.) >>> a/b 9 It was my decision, in the __repr__ method, to have that little decimal point in the denominator. This allows conversion to float simply by evaluating a stringified representation: >>> eval(str(a+b)) 0.83333333333333337 although __float__ is also defined: >>> float(a+b) 0.83333333333333337 Using a parallel infrastructure, we would define polyhedra as another kind of object, based on a list of coefficients as parameters: >>> from mathobjects import Poly >>> p = Poly([1,2,3,4]) >>> p x**3 + 2*x**2 + 3*x + 4 >>> q = Poly([3,-2,-1,-1]) >>> p*q 3*x**6 + 4*x**5 + 4*x**4 + 3*x**3 - 13*x**2 - 7*x - 4 >>> p-q -2*x**3 + 4*x**2 + 4*x + 5 >>> p+q 4*x**3 + 2*x + 3 A fully generalized system would allow me to use polynomials in the numerator and denominator of Fractions, but so far my polynomial objects don't understand the / operator -- dividing polys is somewhat difficult, especially if you plan to simplify them (which involves finding common factors, i.e. the gcd). However, I *am* able to use the Fraction objects as coefficients if I like: >>> r = Poly([a,b,1]) >>> r (3/4.)*x**2 + (1/12.)*x + 1 >>> r*p (3/4.)*x**5 + (19/12.)*x**4 + (41/12.)*x**3 + (21/4.)*x**2 + (10/3.)*x + 4 And to pass values to the polynomial, as a function: >>> s = r*p >>> s(10) (284437/3.) >>> s(-12) -158976 Note that s(10) returned a fraction, not a decimal. This is because my evaluator processes coefficients as fractions, in order to make sure we don't loose any information as a result of casting to floating point. It was by building polynomials such as the above, and passing values to them, that I developed the Bernoulli numbers: >>> bernoulli.bernseries(14) [1, (1/2.), (1/6.), 0, (-1/30.), 0, (1/42.), 0, (-1/30.), 0, (5/66.), 0, (-691/2730.), 0, (7/6.)] The Matrix object, with subclass Sqmatrix (square matrix) works the same way, with *, ** (power), +, - and / overrridden. The elements of a matrix may be Fractions or Polys. So the idea is to learn about mathematical objects by building them, just as we build radios or other models to learn about their design and structure. The result is, in this case, a primitive computer algebra system. In math class, we would spend more time talking about fractions, lcm, gcd, the determinant of a matrix and so on, and less time worrying about the syntax and infrastructure of Python, which presumably they picked up somewhat earlier -- maybe in 8th grade, whereas by this time we're in high school. I gather you take a similar approach with Scheme, focusing increasingly on the knowledge domain as time goes on, with Scheme itself receiving less emphasis. Kirby From pdx4d@teleport.com Wed May 30 05:13:57 2001 From: pdx4d@teleport.com (Kirby Urner) Date: Tue, 29 May 2001 21:13:57 -0700 Subject: [Edu-sig] Speaking of factorials... In-Reply-To: <3.0.3.32.20010528174453.0153bab8@pop3.norton.antivirus> References: <3.0.3.32.20010528143430.015309d8@pop3.norton.antivirus> Message-ID: <3.0.3.32.20010529211357.01368b8c@pop3.norton.antivirus> PS: good idea, about getting into compression algorithms. I'd like to learn more about all that myself. Could be lotsa fun, and the links to crypto and information theory are promising too. Now for something completely different -- and Because I said I would... >>goodcombo 1.506 >>badcombo 1.659 >>shortcomb 0.615 > >Oooo, fast machine. Tomorrow I upgrade from this AMD 400 Mhz >to a 1.2 Mhz AMD Thunderbird -- will retest for kicks. ^ G New machine: > goodcombo 0.667 > badcombo 1.053 > shortcomb 0.427 Then: goodchoice2 7.037 Now: goodchoice2 1.778 Then: comb 5.699 Now: comb 1.474 Conclusion: the faster chip is faster. Kirby From erburley@ix.netcom.com Wed May 30 06:08:59 2001 From: erburley@ix.netcom.com (Brent Burley and Pat Erb) Date: Tue, 29 May 2001 22:08:59 -0700 Subject: [Edu-sig] Regular Expressions Message-ID: <002201c0e8c6$a71f7840$2453d8ce@68k2f01> Does anyone teach regular expressions? I think it's one of the most powerful programming tools (and from my informal observations, one of the most overlooked). A rule of thumb I use in Python (and Perl) is that if you're accessing individual characters in a string, especially in a loop, there's a good chance it would be better done with a regular expression. Regular expressions can be intimidating to the uninitiated, and even the experienced often require several tries to get an expression right. Python's interactive nature helps, but it's fairly tedious to test a regular expression at a python console. I've written a tool called Recon , the Regular Expression Test Console. I use it for debugging regular expressions, but I also think it would be a great teaching tool since it provides a very simple, focused environment with detailed feedback. It's best described by the screen shot: http://erburley.home.netcom.com/recon.html If you want some exercises, try to write expressions for the following: - date (single or multiple formats) - currency - numbers, int/float/fraction/hex/e-notation/etc - words (consider line breaks and hyphens for a challenge!) - doubled words (as in "the the") - phone number, w/ international prefix - program identifiers - python comments (don't forget to skip # in a string) - C++ comments (hard to do right!) - python argument lists, including keyword args Brent Burley From agauld@crosswinds.net Wed May 30 04:26:16 2001 From: agauld@crosswinds.net (Alan Gauld) Date: Wed, 30 May 2001 08:26:16 +0500 Subject: [Edu-sig] Regular Expressions Message-ID: <3b14e6e8.124cb.0@crosswinds.net> >Does anyone teach regular expressions? I included a chapter on RE in my beginners book. The bulk of the content can be found in an article on the infomIT web site (you need to register, but its free). > I think it's one of the most powerful programming > tools (and from my informal observations, one of > the most overlooked). I agree, hence the chapter. But I also acknowledge that REs can be very daunting to a novice - they can just look so incomprehensible. > I've written a tool called Recon , > the Regular Expression Test Console. If I'd known and its freely available I might have asked permission to put it on the CDROM! :-) >http://erburley.home.netcom.com/recon.html It certainly looks good... Alan G. http://www.crosswinds.net/~agauld From gritsch@iue.tuwien.ac.at Wed May 30 16:33:34 2001 From: gritsch@iue.tuwien.ac.at (Markus Gritsch) Date: Wed, 30 May 2001 17:33:34 +0200 Subject: [Edu-sig] Regular Expressions References: <002201c0e8c6$a71f7840$2453d8ce@68k2f01> Message-ID: <3B1512CE.6F654531@iue.tuwien.ac.at> Brent Burley and Pat Erb wrote: > I've written a tool called Recon , the Regular Expression Test Console. I > use it for debugging regular expressions, but I also think it would be a > great teaching tool since it provides a very simple, focused environment > with detailed feedback. It's best described by the screen shot: > http://erburley.home.netcom.com/recon.html Very nice program! It is extremely helpful when trying different Regular Expressions and if you want to show sb how REs work. Thank you very much. Markus From bchang@artic.edu Wed May 30 21:15:18 2001 From: bchang@artic.edu (bchang@artic.edu) Date: Wed, 30 May 2001 15:15:18 -0500 (CDT) Subject: [Edu-sig] programming for artists Message-ID: <991253718.3b1554d6ac3c9@webmail.artic.edu> hello, i teach multimedia and web design at an art school as part of a curriculum that includes neon, kinetics, holography, microcontrollers, digital imaging and video, and pretty much anything else that involves technology. a lot of the problems our students run across require programming of one kind or another, and this trend seems to be increasing. my courses concentrate on programming a good deal, using javascript, flash/actionscript, or director/lingo for websites, cd-roms, gallery installations, etc. however, a good part of every semester is taken up with basic programming concepts before we can get to the "good stuff". i'd like to introduce a solid programming class at the foundation level, and python seems like an interesting possibility. i haven't learned it yet, but have been working in c++, java, perl, etc. for a while so hopefully i can get a handle on it by september . the problem with the approach we've been using (javascript, lingo, or actionscript as an introduction) is that each of these languages has a lot of features and quirks which are very unique, which gets in the way of teaching general programming concepts. i'd like to use something that will let me teach core concepts quickly without getting stuck on too many language- specific details. at the same time, whatever i use will have to be something that students can use to produce interesting results quickly as well - since this is an art school, we're really interested in artistic applications of programming rather than, say, calculating compound interest or the traveling salesman problem. so, my question is - has anyone used python for teaching art students? does this sound like a reasonable thing to do? oh, one problem - it won't even be a full semester course, but just 5 weeks - the foundation class also spends 5 weeks on sound and 5 on electronics. not my choice, just the way the curriculum is structured. so what i'd want to be able to do is get students going with python, understand some basic programming concepts like variables, math, strings, functions, and hopefully events, and be able to make something simple but visually pleasing. does that sound possible? thanks, Ben Chang bchang@artic.edu Department of Art and Technology Studies School of the Art Institute Chicago, IL From Arthur_Siegel@rsmi.com Thu May 31 00:24:20 2001 From: Arthur_Siegel@rsmi.com (Arthur_Siegel@rsmi.com) Date: Wed, 30 May 2001 18:24:20 -0500 Subject: [Edu-sig] programming for artists Message-ID: <00739C37.N22121@rsmi.com> BEN WRITES - >oh, one problem - it won't even be a full semester course, but just 5 weeks - the >foundation class also spends 5 weeks on sound and 5 on electronics. not my >hoice, just the way the curriculum is structured. so what i'd want to be able >to do is get students going with python, understand some basic programming >concepts like variables, math, strings, functions, and hopefully events, and be >able to make something simple but visually pleasing. does that sound possible? Here in Pythonland all is possible. Seems to me Python with Numeric and VPython (see http://virtualphoton.pc.cc.cmu.edu/projects/visual/) is the best toolset you are apt to find to accomplish your mission. Have you looked at VPython and its demos yet? ART From Arthur_Siegel@rsmi.com Thu May 31 00:41:39 2001 From: Arthur_Siegel@rsmi.com (Arthur_Siegel@rsmi.com) Date: Wed, 30 May 2001 18:41:39 -0500 Subject: [Edu-sig] Writing a web server Message-ID: <00739C38.N22121@rsmi.com> Brent wrties - >How's this for a possible 9th/10th grade course: >* Web Programming with Python - Students will program a fully-functioning >website from scratch. Students will choose from building an interactive >storybook where the reader influences the outcome of the story, or a >web-community site with a message board and voting booth. No prior >programming experience necessary. > etc. I strongly agree that this kind of approach will have kids sitting up straight in their chairs.. Would have me sitting up straight in my chair. Wish I had more time to spend with the web based toolset provided with and by Python - not so much to do a site, but to get a decent peek under the hood of Internet technology. Months ago I talked about my niece showing off the radio she built from a kit - coiling wires around a tube etc. Kids curiosities are exactly what you expect them to be - how does the stuff around me work. Conways Game of Life is interesting enough, but does not speak to kids fundamental curiosity. The problem is that any discussion of Web and education seems to quickly become A Project - building some sophisticated web-based infra-structure/learning environment. And building a few reputations in the process. Taking something as simple as SimpleServer and making it, if anything, simpler - as you are suggesting - building ones own Web with coiled wires, is the truly revolutionary approach and where the gold is, IMO. ART, From Jason Cunliffe" Message-ID: <001a01c0e9b5$b9955d60$cc090740@megapathdsl.net> Sounds like you have some lucky students :-) Among the multimedia Python goodies I recommend: -Blender -LightFlow -PyGame -Snack -Poser4ProPack The first four are free. -Blender has lots of nice Python API. And some good tutorials. Even if you dont directly do much with it, it would be worth 1 class well spent to just see what you can do and discuss the Python aspects. http://www.blender.nl http://www.janw.gothere.uk.com/documentation.html http://jmsoler.free.fr/didacticiel/blender/tutor/english/index_prog_python.h tm http://jmsoler.free.fr/didacticiel/blender/tutor/english/python_script00.htm http://jmsoler.free.fr/didacticiel/blender/tutor/english/python_script05.htm http://www-users.cs.umn.edu/~mein/blender/plugins/python.cgi http://honk.physik.uni-konstanz.de/~strubi/3d/python/ -Lightflow is an incredibly beautiful radiosity toolkit. This is directly modelling light in an object-oriented fashion. A few lines of python are enough to nake some breathtaking magic. See the examples and tutorial. http://www.lightflowtech.com/ -PyGame lets you talk to the and do all sort of othre direcit soudn and sprite stuff. Probably not enough time but again may good for one class http://pygame.seul.org/ http://pygame.seul.org/docs/index.html || CD || Channel || Font || Joystick || Rect || Sound || Surface || || pygame || UserRect || cdrom || constants || cursors || display || draw || || event || font || image || joystick || key || mixer || mixer_music || || mouse || surfarray || time || transform || -Snack lets you do for Sound what Lightflow does for Light+Space http://www.speech.kth.se/snack/ http://www.speech.kth.se/snack/websnack.html The Snack Sound Toolkit is designed to be used with a scripting language such as Tcl/Tk or Python. Using Snack you can create powerful multi-platform audio applications with just a few lines of code. Snack has commands for basic sound handling, e.g. sound card and disk I/O. Snack also has primitives for sound visualization, e.g. waveforms and spectrograms. It was developed mainly to handle digital recordings of speech, but is just as useful for general audio. Snack has also successfully been applied to other one-dimensional signals. The combination of Snack and a scripting language makes it possible to create sound tools and applications with a minimum of effort. This is due to the rapid development nature of scripting languages. As a bonus you get an application that is cross-platform from start. It is also easy to integrate Snack based applications with existing sound analysis software. -Poser4ProPack is alas not free. But the good news is the new python API. Your class would probably really enjoy this - Full pyhon control of choreography puppets, human motion files, props, poses, lights camera action.. http://www.curiouslabs.com/products/proPack/ http://www.curiouslabs.com/products/proPack/python/index.html http://techweb.techreviews.com/printableArticle?doc_id=TT20010118S0023 http://poseworks.8m.com/ The Poser® Pro Pack is an essential extension to Poser® 4, the Premier 3D-Character Animation Tool. The Pro Pack offers a combination of robust plug-ins that enable the hosting of Poser scene files inside of 3DstudioMax® and LightWave®, exporters to generate 2D Flash animation, and web deployable 3D characters via Viewpoint output, and delivers added core functionality such as Motion Blur, Multi-pane Views, and fully scriptable application control through a Python Interface. New Figure Set-Up tools make it easy to create new characters from any geometry. From creating 2D Flash and streaming 3D for the web, or integrating Poser scenes into powerful 3D tools, the Pro Pack transforms Poser 4 into a character animation powerhouse. To see a tour of the Pro Pack, click here. The Pro Pack is available as a Hybrid CD with both Macintosh and Windows versions on the same CD. It includes a full-color Introduction Guide and an electronic User's Guide in PDF and HTML formats. I have more detailed urls for all the above, but not on hand. Thse are quicke\ies from my IE favorites. See my previous posts to edu-sig and/or ask me for more. Other artist/programmers using Python: Disney Imagineering Larry Cuba http://www.well.com/user/cuba/ Why Does an Artist Need Python? http://www.oreillynet.com/pub/w/python_presentations.html Also - could be useful to scan the growing Python Job postings: http://www.python.org/Jobs.html {Disney job posted last September } good luck ./JASON