From altis@semi-retired.com Tue Apr 1 17:32:40 2003 From: altis@semi-retired.com (Kevin Altis) Date: Tue, 1 Apr 2003 09:32:40 -0800 Subject: [Edu-sig] The big Python in Education links page Message-ID: Kirby said: "The following mega list of links to Python in academia was originally compiled by W. Chun in 2002 and passed to me by Kevin Altis in 2003. I've weeded out broken or duplicate links, adding a descriptor to each. I'll be sorting and adding to this list as time permits." http://porpig.7technw.com/Members/pdx4d/links.html Kirby Urner is leading the "marketing" effort for Python in Education. Collecting info on the schools, projects, and people using Python in Education is the first step. If you have information to add to the list, please email the info to Kirby. Kirby's home pages: http://porpig.7technw.com/Members/pdx4d http://www.inetarena.com/~pdx4d/ocn/cp4e.html ka ps. I got back home from the PyCon trip late last night, so the next few days will be spent digging out from under email and such. Along the way I'll start composing some PyCon follow-ups and getting out the first summary of the "problems with Python" document. If you've sent me something in the last week and haven't got a response yet, I will get to your email soon. From urnerk@qwest.net Thu Apr 3 01:22:11 2003 From: urnerk@qwest.net (Kirby Urner) Date: Wed, 02 Apr 2003 17:22:11 -0800 Subject: [Edu-sig] Some design patterns with iterators In-Reply-To: <5.2.0.9.0.20030330233404.02377268@pop.ptld.qwest.net> References: <5.2.0.9.0.20030330213831.0231c370@pop.ptld.qwest.net> <200303310044.h2V0i1D01899@pcp02138704pcs.reston01.va.comca st.net> <"Your message of Sun, 30 Mar 2003 13:06:48 PST." <5.2.0.9.0.20030330113646.02442c28@pop.ptld.qwest.net> <200303141930.51941.ahimsa@onetel.net.uk> <5.2.0.9.0.20030330113646.02442c28@pop.ptld.qwest.net> Message-ID: <5.2.0.9.0.20030402171258.0237d318@pop.ptld.qwest.net> So, based on the foregoing, I'm playing around with the Seq class below as a kind of template iterator. It's designed to accept a passed-in test, or to let the user override the default test method -- or to not supply a test at all. The idea is: you want to generate this sequence, based on some rule. By subclassing Seq, you inherit the iterator qualities you need, so you can just focus on the __init__ and update methods, which define the variables you'll be using, the the rule for going from one term to the next in sequence (hence the name Seq). The other wrinkle is the reset() method, which restores the iterator to its initial state. I'm not sure if this is a good idea, but it seems like it might be useful. Example use: >>> def t(self): return self.t1>1000 >>> fibs = iters.Fibseq(0,1,t) >>> for i in fibs: print i, 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 >>> fibs.reset() >>> fibs.next() 1 #---------- iters.py from __future__ import division class Seq(object): """ Subclass and override update() to do the next iteration and to return a next value. Your subclass's __init__ should define whatever instance variables you need, including one named 'test' if you want to pass in a test for the purpose of limiting iteration. Or you may choose to override test in the source code. Iteration stops when the passed in test returns True. The test function, if written externally, should have self as an argument, and refer to your instance variables as if in a class, e.g. as self.variable. """ def next(self): if not self.__dict__.has_key("_savedict"): self._savedict = self.__dict__.copy() if self.test(self): raise StopIteration else: return self.update() def update(self): pass def test(self): return False def __iter__(self): return self def reset(self): if self.__dict__.has_key("_savedict"): self.__dict__ = self._savedict.copy() class Fibseq(Seq): """ Demonstrates how to subclass Seq. In this case, a test will be supplied upon initialization. The user need define only __init__ and update. """ def __init__(self,t1,t2,test): self.t1 = t1 self.t2 = t2 self.test = test def update(self): self.t1, self.t2 = self.t2, self.t1 + self.t2 return self.t1 From urnerk@qwest.net Sun Apr 6 09:47:55 2003 From: urnerk@qwest.net (Kirby Urner) Date: Sun, 06 Apr 2003 00:47:55 -0800 Subject: [Edu-sig] Re: Python Anxiety In-Reply-To: <5.2.0.9.0.20030402171258.0237d318@pop.ptld.qwest.net> References: <5.2.0.9.0.20030330233404.02377268@pop.ptld.qwest.net> <5.2.0.9.0.20030330213831.0231c370@pop.ptld.qwest.net> <200303310044.h2V0i1D01899@pcp02138704pcs.reston01.va.comca st.net> <"Your message of Sun, 30 Mar 2003 13:06:48 PST." <5.2.0.9.0.20030330113646.02442c28@pop.ptld.qwest.net> <200303141930.51941.ahimsa@onetel.net.uk> <5.2.0.9.0.20030330113646.02442c28@pop.ptld.qwest.net> Message-ID: <5.2.0.9.0.20030406004316.01ecb3c0@pop.ptld.qwest.net> Here's an email from the front lines. I asked Shelley's permission to post it to edu-sig and she gave it -- and of course I invited her to join this discussion list, which she says she'll plan to do soon, once she gets some other things out of her in box. My reply to Shelley's letter follows (next post). I hope this might generate some further discussion on our list. Shelley will be able to catch up on the thread via the web archives if she likes. Kirby ============================================= Date: Sun, 06 Apr 2003 00:29:48 +0100 From: Shelley Walsh To: urnerk@qwest.net Subject: Python Anxiety Hi Kirby, I don't know whether you remember me, but I have seen your posts many times in the various math education groups, and it was through you that I discovered Python. The first time I saw it, I was absolutely delighted with its potential for helping with math understanding. But lately I have become disillusioned, because I am constantly finding that students don't like Python, and I can't at all figure out why. I thought at first it was because I was teaching students who were very computer illiterate, but then recently I have had the opportunity to teach a Discrete Mathematics for Computing distance education class, and again I saw great potential for using Python to make the abstract ideas more concrete, but again it has fallen flat. Many of these students have programmed in C++ and Java, so you would think they could learn enough Python for what I was suggesting in 5 minutes. I don't know C++ and Java and it only took me a slight bit longer. I have given them so many opportunities for extra credit projects having to do with it that they could all have perfect scores for the class if they wanted, but nobody has taken the bait. But partly this doesn't surprise me, because these distance education students are very lazy. There are a lot of people that do DE for a free ride, and the familiar is always more comforting to such people. But what really shocked me was the experience I had today with my colleagues when I tried to show it to them as something with great potential for help with understanding algebra. I was just showing them how you could use it as something better than a hand calculator for doing such things as solving equations by searching, which I think is a really good idea for keeping students in touch with the base meaning of solving equations. And one of my colleagues practically expressed horror and said that this would totally put him off of mathematics. And others expresses similar opinions. I remember the first time I saw you write about how you could define a function in the console mode def f(x): return x**2, and then proceed to evaluate it on form a composition function, I immediately thought that was just such a great way for students to see such things right in front of their eyes, for them to no longer be abstract. But he seemed to think it would take him hours to master the syntax of it and for the students it would be just one more thing to learn when they were already afraid of the subject. And partly from some of the reactions I have gotten from students, it seems that he is likely to be right. For him the fact that it there is a : and a return instead of just an equal sign was totally daunting and the ** makes it even worse. So my question for you is have you found this kind of Python anxiety, and if so how have you dealt with it? -- Shelley Walsh shelley.walsh9@ntlworld.com http://homepage.mac.com/shelleywalsh From urnerk@qwest.net Sun Apr 6 09:52:26 2003 From: urnerk@qwest.net (Kirby Urner) Date: Sun, 06 Apr 2003 00:52:26 -0800 Subject: [Edu-sig] Re: Python Anxiety In-Reply-To: <5.2.0.9.0.20030402171258.0237d318@pop.ptld.qwest.net> References: <5.2.0.9.0.20030330233404.02377268@pop.ptld.qwest.net> <5.2.0.9.0.20030330213831.0231c370@pop.ptld.qwest.net> <200303310044.h2V0i1D01899@pcp02138704pcs.reston01.va.comca st.net> <"Your message of Sun, 30 Mar 2003 13:06:48 PST." <5.2.0.9.0.20030330113646.02442c28@pop.ptld.qwest.net> <200303141930.51941.ahimsa@onetel.net.uk> <5.2.0.9.0.20030330113646.02442c28@pop.ptld.qwest.net> Message-ID: <5.2.0.9.0.20030406004920.01ecb3c0@pop.ptld.qwest.net> Here was my reply to Shelley, for which she has since thanked me (and given permission for me to share this correspondence). =============== Date: Sat, 05 Apr 2003 17:20:54 -0800 To: Shelley Walsh From: Kirby Urner Subject: Re: Python Anxiety Thanks for your interesting letter Shelley. If you're willing, I'd like to post it to edu-sig, the Python mailing list re Python in education. Or perhaps you'd like to subscribe to it, as here's a community of people interested in this goal. See: http://www.python.org/sigs/edu-sig for more info. Re your specific questions, I have to confess up front that I have very limited personal experience trying to phase in Python in the ways I suggest. I would *like* to have more of these opportunities, but the fact is that I am not now a classroom teacher (I used to be, but that was many years ago). When I do get together in a room to present Python or Python-related topics, chances are they're already sold on the program -- I'm mostly just preaching to the choir as it were. With that confession out of the way, I will attempt to give you some feedback. I think you're encountering two different reactions here, when you talk about (a) trying to teach Python to students who may already have some C++ or Java experience versus (b) showing off Python's potential utility as a math-teaching aid to faculty members in a mathematics department. In the former case, there's some chauvinism in the various language communities. C++ and Java both take longer to become productive in than Python, and are better established in the commercial sector. Python does enjoy a growing following on many fronts, but it's not atypical to encounter dismissive attitudes amidst those who've already made considerable investment in another language. My riposte is that anyone serious about programming needs to keep an open mind and appreciation for multiple languages. The idea of a "monolingual professional programmer" is something of an oxymoron. More specifically, to C/C++ people I'll point out that Python is open source, written in C, and extensible in C/C++, so if you have C/C++ skills, you have lots of opportunities in the Python community, which is inhabited by a great many accomplished and sophisticated C programmers (Python being a wonderful example of C's capabilities). To Java people, I'd point out Jython, a version of Python implemented entirely in Java, and through which one has interactive access to the complete Java class hierarchy. Serious Java programmers needn't leave Java behind in order to avail them- selves of Jython's power, and should realize that schools using Python and Jython are not necessarily competing with the Java community -- on the contrary, they're helping to train a next generation of Java programmer. Also in this context, I might direct these skeptics to Bruce Eckel's web site: http://www.mindview.net/. Here's an excerpt from an interview at this site, which you might find interesting, given your own experience with distance education: One of the things I'm working on now is a distance-learning program for people who want to learn to program using Python. I think it will be a much faster and more efficient way for people to come up the learning curve. This is still in the formative stages; as you might have guessed by now I generally think about something for awhile before the right approach comes to me. Once you've had success with programming and are comfortable with objects, then you're ready to tackle a language like C++ or Java, which is heavier weight and has more arbitrary details for the programmer to master (or become confused by). [ http://www.mindview.net/Etc/About/InformITRaw_html ] So here's a guy with some very deep and meticulous books on both C++ and Java -- who now advocates Python as his current language of choice. Again, Python is not just some toy academic language, nor just a "scripting language" beneath the dignity of serious programmers. It's a very high level general purpose language, and learning it first can make Java and C++ a lot more accessible -- as second or third languages. But with the math teachers, I think the reaction is coming from a different place. If they're horrified by the colon and the return keyword in Python, they'll be even more horrified by all the syntactical clutter of *any* computer language -- even Mathematica, which has gone a long way to accommodate traditional math notation. But as Wolfram points out, traditional notation is ambiguous. Does s(x-1) mean the function s, applied to x-1, or does it mean s times x-1? In Mathematica, when a function is being applied, we use square brackets exclusively, while curved parentheses serve to indicate the order of operations. Whereas humans can tolerate a lot of ambiguity, owing to sensitivity to context, computers cannot. And so in a lot of ways, computers force *more* precision on a notation. With math educators, it does no good to talk about Python's power and sophistication vis-a-vis C++ and Java. Their beef is with the whole idea of diluting the purity of their discipline with material from an alien discipline, i.e. computer science and/or engineering. To start using a computer language in an early math curriculum looks like the harbinger of nothing good: it means math will become mixed up with all kinds incompatible grammars which come and go, vs. the staying power of a more stable, core notation. Plus if computer languages invade the math classroom, then teachers will be forced to learn programming, which many are loathe to take up. The hand held graphing calculator is as far into computing technology as these teachers want to go, and even there, their programmability is often ignored. But not all math educators are on the same page here. Many recognize the advantage of having an "executable math notation" vs. one that just sits there on the printed page, doing nothing (except crying out to be deciphered). Kenneth Iverson makes this point very clearly when he writes: It might be argued that mathematical notation (to be referred to as MN) is adequate as it is, and could not benefit from the infusion of ideas from programming languages. However, MN suffers an important defect: it is not executable on a computer, and cannot be used for rapid and accurate exploration of mathematical notions. Kenneth E. Iverson, Computers and Mathematical Notation, available from jsoftware.com It's this ability of computer languages to promote the "rapid and accurate exploration of mathematical notions" which some of us find exciting and empowering (and if you want to impress math teachers with a wholly alien notation, which nevertheless expresses a lot of the same ideas (sometimes as generally and formally as any traditional notation), have them look at APL or J). Furthermore, one might argue that imparting numeracy is *not* limited to teaching just those topics and notations most traditionally favored within mathematics. It's about imparting some familiarity and comprehension around *whatever* happen to be the culture's primary symbolic notations (music notation included) beyond those which we group under the heading of literacy. We need to provide some exposure to computer languages because our industrial society is completely dependent upon them, because they've become ubiquitous. We have the choice of segregating these topics from mathematics, just as we've divorced mathematics from the physical sciences. But some educators in every generation advocate curriculum integration through cross-pollination, and to such educators, it makes perfect sense to meld computer topics with math topics, with science and even humanities topics (cryptography is a good example of where all of these converge). In my view, the benefits to be obtained through synergy outweigh the arguments of turf-protectors who would keep their respective disciplines "pure". That's the kind of overview debate I think is going on here. Then come the more specific points about the advantages of a computer language such as Python, versus the calculators, which are already pretty well established. Python's abilities with big integers are another selling point. Even though some calculators can work with 100-digit integers, they have a lot more trouble displaying them (more an argument for a big screen over a tiny one). The ability to scroll back through a work session is another advantage. And I think algorithms which involve alphanumeric processing, not just numeric processing, should get more central treatment, including in mathematics. For example, it's fine to express permutations using integers only, but for applications purposes, it's best if we can map 1-27 to the 26 letters and a space. Then you can see how a permutation results in a scrambling of the alphabet -- back to cryptography again (I recommend Sarah Flannery's 'In Code' by the way -- she's very clear about how important Mathematica was to her conceptual development -- which isn't the same as Python of course, but some of the same synergies apply). Thanks again for your interesting letter. If you give your permission, I'll post it, along with my response, to edu-sig, in hopes of generating more discussion along these lines. Or again, perhaps you'd like to subscribe and make a fresh start. I think the attitudes you're running up against are not unique to your experience and it might benefit a lot of us to take part in more of such discussion. Sincerely, Kirby From ajs@optonline.net Sun Apr 6 16:17:22 2003 From: ajs@optonline.net (Arthur) Date: Sun, 06 Apr 2003 10:17:22 -0500 Subject: [Edu-sig] Re: Python Anxiety Message-ID: <000a01c2fc4f$9ff7d370$1a02a8c0@BasementDell> This is a multi-part message in MIME format. --Boundary_(ID_5gZWOJFXM3pqVFb44unW4w) Content-type: text/plain; charset=iso-8859-1 Content-transfer-encoding: 7BIT Interesting correspondence. I think it gets to the heart of a number of issues. >With math educators, it does no good to talk about Python's power >and sophistication vis-a-vis C++ and Java. Their beef is with the >whole idea of diluting the purity of their discipline with material >from an alien discipline, i.e. computer science and/or engineering. And, unfortunately, its a two-way street. Had an opportunity to chat briefly with Jeff Elkner at PyCon, who was there in force with his students (who I suspect can Python *me* under the table). I specifically asked Jeff whether he saw any merit, or has made any efforts, in doing something interdisclinary with any math folks in his school. He pointed out the pracitical problems - busy teachers, on their own tracks, working within defined expectations as to curriculum. But he also seems to admit that he himslef would be uncomfortable with too much math in a programming related curriculum. He seems clearly concerned that linking the curriculum too closely will turn off students who have a purer interest in programming. (My best counter is that 3d graphics is a area of everyday computing of interest to many younger - and some older - folks. Why shouldn't it be approached in as low a level a way as possible. It appears the Elkner's students get pretty low level into networking issues, e.g. The fact that 3d graphics at anything much below the point and click level is math intensive, is a fact of life. Are his students willing to write-off the possibility of doing anything truly interesting in that realm? Maybe some are. I can't believe most are.) >To start using a computer language in an early math curriculum >looks like the harbinger of nothing good: it means math will >become mixed up with all kinds incompatible grammars which come >and go, vs. the staying power of a more stable, core notation. What level or age is Shelley thinking about? Personally, I am not too keen at introducing any of this too early in the game - except in the atypical case, where a child has expressed a specfic interest. Like the recent 11 year old on python-list. But in those cases the child seems to find their own way to pursue what interests them, and it may be best, if it is going to be apporached formally at all, as an enrichment program of some sort, rather than anything near the core. The Scheme world has (or had, not sure of its status) Schemers, Inc. - a commerical venture offering an after school enrichment program based on Scheme http://www.schemers.com/schmrs2.html '''' The Scheme Advantage? Scheme is easier, more powerful, and more practical. a.. With Scheme, students as young as sixth grade are able to grasp such advanced concepts as recursion. b.. Because Scheme is much easier, with less computerese, students can concentrate on the concepts rather than the syntax. c.. Clear and elegant, Scheme makes programming fun to learn. d.. Scheme forces students to think about computation and to develop good programming techniques. e.. The novice can be writing powerful programs in Scheme much sooner than in BASIC, Pascal, or C, while gaining a more comprehensive understanding of the process. """ Now of course this program was designed pre-Python. There may be a basis for a number of religious debates between Scheme and Python devotees. And I am sure the Schemer folks have their points (something about closures, seems to be a religious point given emphasis by the Schemers.) But given this particular list of "The Scheme Advantage", I find it hard to understand how Python cannot be seen as a more significant advantage in at least 4 out of 5 of the categories mentioned. The main point here, however, is that it seems clear that the program is aimed at exceptional students - exceptional either in their general aptitudes (and in need of enrichment), or exceptional in their specific interest in a programming related extra-curricula activity. Which, IMO, is one way the CP4E "religion" is a problem. An approach aimed at the gifted and a self-selected group of the highly motivated, seems to me a much more realistic approach and one with which there should be no shame associated. It also is relevant - to me - that the Schemers program does much with 3d graphics, and is not programming language dogmatic, in that it specfically includes a path from Scheme to C++ as part of its approach. >Plus if computer languages invade the math classroom, then >teachers will be forced to learn programming, which many are >loathe to take up. The hand held graphing calculator is as far .into computing technology as these teachers want to go, and even >there, their programmability is often ignored. Also at PyCon, another high school level teacher made this point. The curriculum he designed was based, at least in part, on what he knew. Obviously teachers cannot teach what they don't know. Having done some presentation (PyGeo related) to college level math instructors, I was surprised how little was known about even basic programming concepts, even at that level. To me that's just pure anachronism - someone with a math Phd. knowing nothing about programming - in a Very High Level Language, at least. I have always seen the niche of teaching teachers as Kirby's truer calling, BTW. >It's this ability of computer languages to promote the "rapid and >accurate exploration of mathematical notions" which some of us find >exciting and empowering (and if you want to impress math teachers >with a wholly alien notation, which nevertheless expresses a lot >of the same ideas (sometimes as generally and formally as any >traditional notation), have them look at APL or J). and etc. Seems to me much of this again speaks to the slow reaction to rapid change in all institutions - including educational institutiions. And the need to make teaching the teachers an early priority. Which in some sense what the Kirby/Shelly correspondance is about. Some progress, at least. Art --Boundary_(ID_5gZWOJFXM3pqVFb44unW4w) Content-type: text/html; charset=iso-8859-1 Content-transfer-encoding: 7BIT
Interesting correspondence.  I think it gets to the heart of a number of issues.
 
>With math educators, it does no good to talk about Python's power
>and sophistication vis-a-vis C++ and Java.  Their beef is with the
>whole idea of diluting the purity of their discipline with material
>from an alien discipline, i.e. computer science and/or engineering.
And, unfortunately, its a two-way street. 
 
Had an opportunity to chat briefly with Jeff Elkner at PyCon, who was there in force with his students (who I suspect can
Python *me* under the table).
 
I specifically asked Jeff whether he saw any merit, or has made any efforts, in doing something interdisclinary with any math folks in his school.  He pointed out the pracitical problems - busy teachers, on their own tracks, working within defined expectations as to curriculum.
 
But he also seems to admit that he himslef would be uncomfortable with too much math in a programming related curriculum. He seems clearly concerned that linking the curriculum too closely will turn off students who have a purer interest in programming.
 
(My best counter is that 3d graphics is a area of everyday computing of interest to many younger  - and some older - folks.  Why shouldn't it be approached in as low a level a way as possible.  It appears the Elkner's students get pretty low level into networking issues, e.g.  The fact that 3d graphics at anything much below the point and click level is math intensive, is a fact of life.  Are his students willing to write-off the possibility of doing anything truly interesting in that realm?  Maybe some are.  I can't believe most are.)
 
>To start using a computer language in an early math curriculum
>looks like the harbinger of nothing good:  it means math will
>become mixed up with all kinds incompatible grammars which come
>and go, vs. the staying power of a more stable, core notation.
 
What level or age is Shelley thinking about?  Personally, I am not too keen at introducing any of this too early in the game - except in the atypical case, where a child has expressed a specfic interest.  Like the recent 11 year old on python-list. But in those cases the child seems to find their own way to pursue what interests them, and it may be best, if it is going to be apporached formally at all, as an enrichment program of some sort, rather than anything near the core. 
 
The Scheme world has (or had, not sure of its status) Schemers, Inc.  - a commerical venture offering an after school enrichment program based on Scheme 
 
http://www.schemers.com/schmrs2.html
 
''''
The Scheme Advantage?

Scheme is easier, more powerful, and more practical.

  • With Scheme, students as young as sixth grade are able to grasp such advanced concepts as recursion.
  • Because Scheme is much easier, with less computerese, students can concentrate on the concepts rather than the syntax.
  • Clear and elegant, Scheme makes programming fun to learn.
  • Scheme forces students to think about computation and to develop good programming techniques.
  • The novice can be writing powerful programs in Scheme much sooner than in BASIC, Pascal, or C, while gaining a more comprehensive understanding of the process.
"""
 
Now of course this program was designed pre-Python.  There may be a basis for a number of religious debates between Scheme and Python devotees. And I am sure the Schemer folks have their points (something about closures, seems to be a religious point given emphasis by the Schemers.) But given this particular list of "The Scheme Advantage", I find it hard to understand how Python cannot be seen as a more significant advantage in at least 4 out of 5 of the categories mentioned.
 
The main point here, however, is that it seems clear that the program is aimed at exceptional students - exceptional either in their general aptitudes (and in need of enrichment), or exceptional in their specific interest in a programming related extra-curricula activity.
 
Which, IMO, is one way the CP4E "religion" is a problem.  An approach aimed at the gifted and a self-selected group of the highly motivated, seems to me a much more realistic approach and one with which there should be no shame associated. 
 
It also is relevant - to me - that the Schemers program does much with 3d graphics, and is not programming language dogmatic, in that it specfically includes a path from Scheme to C++ as part of its approach.

>Plus if computer languages invade the math classroom, then
>teachers will be forced to learn programming, which many are
>loathe to take up.  The hand held graphing calculator is as far
.into computing technology as these teachers want to go, and even
>there, their programmability is often ignored.
 
Also at PyCon, another high school level teacher made this point.  The curriculum he designed was based, at least in part, on what he knew.  Obviously teachers cannot teach what they don't know.  Having done some presentation (PyGeo related) to college level math instructors, I was surprised how little was known about even basic programming concepts, even at that level. To me that's just pure anachronism - someone with a math Phd. knowing nothing about programming - in a Very High Level Language, at least.  
 
I have always seen the niche of teaching teachers as Kirby's truer calling, BTW. 
 
 
>It's this ability of computer languages to promote the "rapid and
>accurate exploration of mathematical notions" which some of us find
>exciting and empowering (and if you want to impress math teachers
>with a wholly alien notation, which nevertheless expresses a lot
>of the same ideas (sometimes as generally and formally as any
>traditional notation), have them look at APL or J).
and etc.
 
Seems to me much of this again speaks to the slow reaction to rapid change in all institutions - including educational institutiions.  And the need to make teaching the teachers an early priority.
 
Which in some sense what the Kirby/Shelly correspondance is about.
 
Some progress, at least.
 
Art
 
 
 
--Boundary_(ID_5gZWOJFXM3pqVFb44unW4w)-- From urnerk@qwest.net Sun Apr 6 20:56:08 2003 From: urnerk@qwest.net (Kirby Urner) Date: Sun, 06 Apr 2003 12:56:08 -0700 Subject: [Edu-sig] Re: Python Anxiety In-Reply-To: <000a01c2fc4f$9ff7d370$1a02a8c0@BasementDell> Message-ID: <5.2.0.9.0.20030406121410.02a03150@pop.ptld.qwest.net> --=====================_156226351==.ALT Content-Type: text/plain; charset="us-ascii"; format=flowed At 10:17 AM 4/6/2003 -0500, Arthur wrote: >But he also seems to admit that he himslef would be uncomfortable with too >much math in a programming related curriculum. He seems clearly concerned >that linking the curriculum too closely will turn off students who have a >purer >interest in programming. Yeah, I mostly come from the other side of the fence. It's a math class, so math is clearly what's up, but we want to dabble in a programming language, to experiment and explore the concepts. This'd be impractical were the programming language really time-consuming to learn, as they were in the old days. But now we have such creatures as Python, so this is now a more practical goal. > >(My best counter is that 3d graphics is a area of everyday computing of >interest >to many younger - and some older - folks. Why shouldn't it be approached >in as >low a level a way as possible. It appears the Elkner's students get >pretty low level >into networking issues, e.g. The fact that 3d graphics at anything much >below the >point and click level is math intensive, is a fact of life. Are his >students willing to >write-off the possibility of doing anything truly interesting in that >realm? Maybe >some are. I can't believe most are.) Or even 2D graphics. Fractals, turtle spirograph stuff, cellular automata, polygons, and of course ordinary xy graphs (functions, parametric equations, bar graphs etc.). I've been looking more into PythonCard recently (wxPython- based) and admiring what it does in the 2D realm. But yes, of course 3D too. 'Beyond Flatland' -- one of my major themes (and the forte of your PyGeo). > > >To start using a computer language in an early math curriculum > >looks like the harbinger of nothing good: it means math will > >become mixed up with all kinds incompatible grammars which come > >and go, vs. the staying power of a more stable, core notation. > >What level or age is Shelley thinking about? Personally, I am not too >keen at introducing >any of this too early in the game - except in the atypical case, where a >child has expressed >a specfic interest. Like the recent 11 year old on python-list. But in >those cases the child >seems to find their own way to pursue what interests them, and it may be >best, if it is >going to be apporached formally at all, as an enrichment program of some >sort, rather >than anything near the core. I think pretty early, like in teaching algebra. The example she gave was just around showing composition of functions. Like this (my own examples, but similar): >>> def f(x): return x+2 >>> def g(x): return x**2 >>> f(g(10)) 102 >>> g(f(10)) 144 >>> f(f(10)) 14 >>> g(g(f(g(f(g(g(g(f(6))))))))) 6277107721700063361361066218651271080020693109731680584976L I'm imagining a classroom with a data projector fixed to the ceiling, a computer up front. The teacher simply switches it on and dashes off some of these lines, in place of using a chalkboard. That'd be a minimal case. Similarly she could do graphs etc. on the fly. Her idea was that this stuff is interactive, and close enough to standard math notation to be readable. But the more conservative faculty were turned off by the colons and returns. In "real math" they'd write something like f: x-> x+2 I suppose. Looks more like Haskell :-D. >The main point here, however, is that it seems clear that the program is >aimed at exceptional >students - exceptional either in their general aptitudes (and in need of >enrichment), or exceptional >in their specific interest in a programming related extra-curricula activity. The Scheme stuff seems aimed more at students studying programming who might happen to use some math, vs. math students who might happen to use some programming. But I agree that Scheme could be used in the later context as well. > >Which, IMO, is one way the CP4E "religion" is a problem. An approach >aimed at the gifted and >a self-selected group of the highly motivated, seems to me a much more >realistic approach and >one with which there should be no shame associated. > Another branch thread here is what math topics do the most to explicate computer stuff? In computer languages, we make lots of use of bases 2 and 16, boolean operators, data structures. There's the question of what topics to emphasize in early mathematics -- independent of whether we're using a computer language. >>> int(0xFF) 255 >>> int('101001010100',2) 2644 We tend to use calculators for some of this today, but calculators can't do this: >>> bytes = binascii.hexlify("The rain in Spain stays mainly in the plain") >>> bytes '546865207261696e20696e20537061696e207374617973206d61696e6c7920696e2 074686520706c61696e' >>> bignum = eval('0x'+bytes) >>> bignum 11815744420694793501812329697776864896346269902373465542189059127618 705148732921630756455756149486086510L That shows how words may be converted to big integers -- a first step in many cryptography algorithms. >>> binascii.unhexlify(hex(bignum)[2:-1]) # strip 0x, ending L 'The rain in Spain stays mainly in the plain' Here we have the notion of function and inverse function. f: phrase -> number finv: number -> phrase >It also is relevant - to me - that the Schemers program does much with 3d >graphics, and is not >programming language dogmatic, in that it specfically includes a path from >Scheme to C++ as >part of its approach. Python-based curricula could/should also contain bridges to other languages, for those coming from or headed towards. It's interesting to see language comparisons. >>> def tonum(phrase): bytes = binascii.hexlify(phrase) return eval('0x'+bytes) >>> def towords(num): return binascii.unhexlify(hex(num)[2:-1]) >>> asnum = tonum("This is my test phrase") >>> towords(asnum) 'This is my test phrase' >>> towords(tonum("The inverse of f undoes what f does")) 'The inverse of f undoes what f does' I favor more such alphanumeric blends, as more representative of how text and numbers interface in the real world (through unicode and ascii). But it's a math topic. We're talking functions: mapping a domain (of words) to a range (of numbers) and vice versa. >Also at PyCon, another high school level teacher made this point. The >curriculum he designed was >based, at least in part, on what he knew. Obviously teachers cannot teach >what they don't know. Having >done some presentation (PyGeo related) to college level math instructors, >I was surprised how little was >known about even basic programming concepts, even at that level. To me >that's just pure anachronism - >someone with a math Phd. knowing nothing about programming - in a Very >High Level Language, at least. Yes, math is seen as very much a distinct topic, different from compsci or any kind of engineering. However, especially at the early levels, I believe we should be embracing inputs from a great many disciplines, not over-specializing too early -- which is why introductory numeracy materials should be a mix, taking from math, compsi, engineering, the physical sciences, and the humanities. > >I have always seen the niche of teaching teachers as Kirby's truer >calling, BTW. That'd be fun. >Some progress, at least. > >Art Yes, some progress. Kirby --=====================_156226351==.ALT Content-Type: text/html; charset="us-ascii" At 10:17 AM 4/6/2003 -0500, Arthur wrote:

But he also seems to admit that he himslef would be uncomfortable with too
much math in a programming related curriculum. He seems clearly concerned
that linking the curriculum too closely will turn off students who have a purer
interest in programming.

Yeah, I mostly come from the other side of the fence.  It's
a math class, so math is clearly what's up, but we want to
dabble in a programming language, to experiment and explore
the concepts.  This'd be impractical were the programming
language really time-consuming to learn, as they were in
the old days.  But now we have such creatures as Python,
so this is now a more practical goal.

 
(My best counter is that 3d graphics is a area of everyday computing of interest
to many younger  - and some older - folks.  Why shouldn't it be approached in as
low a level a way as possible.  It appears the Elkner's students get pretty low level
into networking issues, e.g.  The fact that 3d graphics at anything much below the
point and click level is math intensive, is a fact of life.  Are his students willing to
write-off the possibility of doing anything truly interesting in that realm?  Maybe
some are.  I can't believe most are.)

Or even 2D graphics.  Fractals, turtle spirograph stuff,
cellular automata, polygons, and of course ordinary xy
graphs (functions, parametric equations, bar graphs etc.).
I've been looking more into PythonCard recently (wxPython-
based) and admiring what it does in the 2D realm.

But yes, of course 3D too.  'Beyond Flatland' -- one of my
major themes (and the forte of your PyGeo).

 
>To start using a computer language in an early math curriculum
>looks like the harbinger of nothing good:  it means math will
>become mixed up with all kinds incompatible grammars which come
>and go, vs. the staying power of a more stable, core notation.

 
What level or age is Shelley thinking about?  Personally, I am not too keen at introducing
any of this too early in the game - except in the atypical case, where a child has expressed
a specfic interest.  Like the recent 11 year old on python-list. But in those cases the child
seems to find their own way to pursue what interests them, and it may be best, if it is
going to be apporached formally at all, as an enrichment program of some sort, rather
than anything near the core. 

I think pretty early, like in teaching algebra.  The example
she gave was just around showing composition of functions. 
Like this (my own examples, but similar):

 >>> def f(x): return x+2

 >>> def g(x): return x**2

 >>> f(g(10))
 102

 >>> g(f(10))
 144

 >>> f(f(10))
 14

 >>> g(g(f(g(f(g(g(g(f(6)))))))))
 6277107721700063361361066218651271080020693109731680584976L

I'm imagining a classroom with a data projector fixed to the
ceiling, a computer up front.  The teacher simply switches it
on and dashes off some of these lines, in place of using a
chalkboard.  That'd be a minimal case.  Similarly she could do
graphs etc. on the fly.

Her idea was that this stuff is interactive, and close enough
to standard math notation to be readable.  But the more
conservative faculty were turned off by the colons and returns.
In "real math" they'd write something like f: x-> x+2 I suppose.
Looks more like Haskell :-D.
 
The main point here, however, is that it seems clear that the program is aimed at exceptional
students - exceptional either in their general aptitudes (and in need of enrichment), or exceptional
in their specific interest in a programming related extra-curricula activity.

The Scheme stuff seems aimed more at students studying programming
who might happen to use some math, vs. math students who might
happen to use some programming.  But I agree that Scheme could be
used in the later context as well.

 
Which, IMO, is one way the CP4E "religion" is a problem.  An approach aimed at the gifted and
a self-selected group of the highly motivated, seems to me a much more realistic approach and
one with which there should be no shame associated.
 

Another branch thread here is what math topics do the most to
explicate computer stuff?  In computer languages, we make lots of
use of bases 2 and 16, boolean operators, data structures.
There's the question of what topics to emphasize in early
mathematics -- independent of whether we're using a computer
language.

  >>> int(0xFF)
  255

  >>> int('101001010100',2)
  2644

We tend to use calculators for some of this today, but calculators
can't do this:

  >>> bytes = binascii.hexlify("The rain in Spain stays mainly in the plain")
  >>> bytes
  '546865207261696e20696e20537061696e207374617973206d61696e6c7920696e2
  074686520706c61696e'
  >>> bignum = eval('0x'+bytes)
  >>> bignum
  11815744420694793501812329697776864896346269902373465542189059127618
  705148732921630756455756149486086510L

That shows how words may be converted to big integers -- a first step
in many cryptography algorithms.

  >>> binascii.unhexlify(hex(bignum)[2:-1])  # strip 0x, ending L
  'The rain in Spain stays mainly in the plain'

Here we have the notion of function and inverse function. 

f:    phrase -> number
finv: number -> phrase



It also is relevant - to me - that the Schemers program does much with 3d graphics, and is not
programming language dogmatic, in that it specfically includes a path from Scheme to C++ as
part of its approach.

Python-based curricula could/should also contain bridges to other
languages, for those coming from or headed towards.  It's interesting
to see language comparisons.

 >>> def tonum(phrase):
         bytes = binascii.hexlify(phrase)
         return eval('0x'+bytes)

 >>> def towords(num):
         return binascii.unhexlify(hex(num)[2:-1])

 >>> asnum = tonum("This is my test phrase")
 >>> towords(asnum)
 'This is my test phrase'

  >>> towords(tonum("The inverse of f undoes what f does"))
  'The inverse of f undoes what f does'

I favor more such alphanumeric blends, as more representative of how
text and numbers interface in the real world (through unicode and ascii).
But it's a math topic.  We're talking functions:  mapping a domain
(of words) to a range (of numbers) and vice versa.
 
Also at PyCon, another high school level teacher made this point.  The curriculum he designed was
based, at least in part, on what he knew.  Obviously teachers cannot teach what they don't know.  Having
done some presentation (PyGeo related) to college level math instructors, I was surprised how little was
known about even basic programming concepts, even at that level. To me that's just pure anachronism -
someone with a math Phd. knowing nothing about programming - in a Very High Level Language, at least. 

Yes, math is seen as very much a distinct topic, different from
compsci or any kind of engineering.  However, especially at the
early levels, I believe we should be embracing inputs from a great
many disciplines, not over-specializing too early -- which is why
introductory numeracy materials should be a mix, taking from math,
compsi, engineering, the physical sciences, and the humanities.

 
I have always seen the niche of teaching teachers as Kirby's truer calling, BTW.

That'd be fun.
 
Some progress, at least.
 
Art

Yes, some progress.

Kirby

--=====================_156226351==.ALT-- From ajs@optonline.net Mon Apr 7 02:08:16 2003 From: ajs@optonline.net (Arthur) Date: Sun, 06 Apr 2003 20:08:16 -0500 Subject: [Edu-sig] Re: Python Anxiety Message-ID: <000901c2fca2$2c355770$1b02a8c0@BasementDell> I had garbled - >This is a multi-part message in MIME format. >--Boundary_(ID_5gZWOJFXM3pqVFb44unW4w) >Content-type: text/plain; charset=iso-8859-1 >Content-transfer-encoding: 7BIT Sorry about the html post, BTW. Setting up a new machine - the "gift" from a client doing some downsizing - and had not gotten to changing the defaults on Outlook Express. The better news being its main purpose is giving me a Linux box. But I was inbetween screwing up my Linux install. Gotta stop loggin in as root. Having hosed my Redhat, decided to Debian. Then having hosed my Debian stable, I'm onto Debian experimental. In the course of which I am beginning to look at Debian Jr, DebianEdu and other Debian and Linux initiatives aimed at children and at free educational software distributions. Ofset http://www.ofset.org/ is particularly interesting to me, as it seems quite active and actually publishes a CD, it seems to have started with (and directly supports) Dr. Genius and Dr. Geo - dynamic geometry apps, and - it doesn't hurt - they list PyGeo in their directory. Will probably pursue finding out what it will take to have PyGeo published on their CD. Could give me the impetus I need to do some decent docs, tutorials. Art From info@componentsengine.com Tue Apr 8 14:05:15 2003 From: info@componentsengine.com (info@componentsengine.com) Date: Tue, 8 Apr 2003 14:05:15 +0100 Subject: [Edu-sig] =?iso-8859-1?B?VGhlIHNwYXJlIHBhcnRzIHJldm9sdXRpb24=?= Message-ID: <009bc1505130843PROGETPLUS01@i-vm.it> This is a multi-part message in MIME format. ------=_NextPart_000_1FD1_01C2FDD7.E11DD5A0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit The spare parts revolution The first appliance dedicated to all companies to meet the requirements and the problems referring to the spare parts management. With Components Engine you can publish and distribute your spares catalogs over the web, cd-rom and on paper. You only need a click. Some advantages Creation and sending of a clear, exact spare parts ordering, outrisk, without any errors and undesired operation. Reduced searching times of component or product through official channels catalog exploring or through product/component features. Any management costs of paper supports and more up-to-date simplicity and quickness of the catalogs. Price Components Engine starting from 750,00 Euro . Demo Download the demo version of Edit Components Engine . componentsengine.com - info@componentsengine.com ------=_NextPart_000_1FD1_01C2FDD7.E11DD5A0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable p1.tif
3D"" 3D"" 3D""
3D""
3D""

The spare parts = revolution

The first appliance dedicated to all companies to meet the = requirements=20 and the problems referring to the spare parts = management.

With Components Engine you can publish and distribute = your spares=20 catalogs over the web, cd-rom and on paper. You only need = a click.

3D""
3D""
=20
Some advantages

  •  Creation and sending of a clear, exact spare = parts ordering,=20 outrisk, without any errors and undesired operation.

  •  Reduced searching times of component or product = through=20 official channels catalog exploring or through = product/component=20 features.

  •  Any management costs of paper supports and more = up-to-date=20 simplicity and quickness of the catalogs.
  • 3D""
    Price

    Components Engine starting=20 from 750,00 Euro.
    3D""
    Demo

    Download the demo version of Edit=20 Components Engine.
    3D""
    3D""
    ------=_NextPart_000_1FD1_01C2FDD7.E11DD5A0-- From ajsiegel@optonline.net Tue Apr 15 13:32:02 2003 From: ajsiegel@optonline.net (Arthur) Date: Tue, 15 Apr 2003 08:32:02 -0400 Subject: [Edu-sig] Computer club in NZ Message-ID: <3E9BFBC2.9000605@optonline.com> Nice surprise. Googled on "povray sdl" looking for resources on the povray scene desciption language, and came across this - as the second hit: http://www.cosc.canterbury.ac.nz/ACMchapter/club/ which is more about Python for kids than the povray sdl or or the SDL library itself. Thought I'd throw it up here, not knowing whether the handouts there on introductory programming with Python are on the radar of known resources. There is something there on povray as well, but - from a quick look. - they haven't seemed to tie together the possiblities of working with Python and povray together, ala the kinds of things that Kirby has been doing, and the VPython povexport.py utility Art From jeff@elkner.net Thu Apr 17 03:06:49 2003 From: jeff@elkner.net (Jeffrey Elkner) Date: 16 Apr 2003 22:06:49 -0400 Subject: [Edu-sig] Lines of code and programmer time... Message-ID: <1050545209.3353.16.camel@gopher> Hi All, I seem to remember hearing a few times about a study somewhere that said that programmers produce about the same number of lines of code in a given amount of time regardless of the language. Does anyone know anything about this study? (or is it a figment of my imagination? :-( I'm putting the final touches on my master's thesis comparing Python and C++ solutions to a set of problems, so this information would be *very* helpful to me. Thanks! -- Jeffrey Elkner From patrick@swdev.com Thu Apr 17 17:31:27 2003 From: patrick@swdev.com (Patrick Curtain) Date: Thu, 17 Apr 2003 09:31:27 -0700 Subject: [Edu-sig] Re: Lines of code and programmer time... In-Reply-To: <20030417160003.32673.71534.Mailman@mail.python.org> Message-ID: <09B2D186-70F2-11D7-BC2A-003065D602EC@swdev.com> Please, Please! Will you share your thesis paper with us when it's done. I'd presume I'm not the only one that would -love- to read your findings! > From: Jeffrey Elkner > To: Edu-sig > Organization: > Date: 16 Apr 2003 22:06:49 -0400 > Subject: [Edu-sig] Lines of code and programmer time... > > Hi All, > > I seem to remember hearing a few times about a study somewhere that > said > that programmers produce about the same number of lines of code in a > given amount of time regardless of the language. Does anyone know > anything about this study? (or is it a figment of my imagination? :-( > > I'm putting the final touches on my master's thesis comparing Python > and > C++ solutions to a set of problems, so this information would be *very* > helpful to me. > > Thanks! > > -- > Jeffrey Elkner From cmeyers@guardnet.com Thu Apr 17 17:49:37 2003 From: cmeyers@guardnet.com (Chris Meyers) Date: Thu, 17 Apr 2003 09:49:37 -0700 Subject: [Edu-sig] Lines of code and programmer time... Message-ID: Jeff, I have read the same thing many, many times but have never seen it attributed to anyone. By my own experience I would agree with it, at least roughly. We have converted quite a bit of very old code written in Fortran 20+ years ago and we see about a 6 to 1 reduction (!) in the size of programs when expressed in Python with modern data structures and objects. So you can do the math. But then add to that the almost complete absence of a compile/link cycle that 20 years ago often took 2-10 minutes (still better than the batch runs at the university computer that you picked up the next day). Now we really are working at the "speed of thought" as someone coined. (Gates?) But I think that the readability (and maintainability) is much more than a simple linear function of the lines of code and that is where perhaps half of our time may be spent. Mainly in very dynamic systems where requirements change frequently. Chris On 16 Apr 2003 22:06:49 -0400, Jeffrey Elkner wrote: > Hi All, > > I seem to remember hearing a few times about a study somewhere that said > that programmers produce about the same number of lines of code in a > given amount of time regardless of the language. Does anyone know > anything about this study? (or is it a figment of my imagination? :-( > > I'm putting the final touches on my master's thesis comparing Python and > C++ solutions to a set of problems, so this information would be *very* > helpful to me. > > Thanks! > -- Chris Meyers From michael.williams@st-annes.oxford.ac.uk Thu Apr 17 18:14:33 2003 From: michael.williams@st-annes.oxford.ac.uk (Michael Williams) Date: Thu, 17 Apr 2003 18:14:33 +0100 Subject: [Edu-sig] Re: Lines of code and programmer time... In-Reply-To: <09B2D186-70F2-11D7-BC2A-003065D602EC@swdev.com> Message-ID: <0EA7E3CC-70F8-11D7-ABBA-000393C5BF0A@st-annes.oxford.ac.uk> Jeffrey Elkner > I seem to remember hearing a few times about a study somewhere that > said > that programmers produce about the same number of lines of code in a > given amount of time regardless of the language. Does anyone know > anything about this study? (or is it a figment of my imagination? :-( > > I'm putting the final touches on my master's thesis comparing Python > and > C++ solutions to a set of problems, so this information would be *very* > helpful to me. http://www.ipd.uka.de/~prechelt/Biblio/jccpprt_computer2000.pdf might be useful, although I don't think it's the study you're referring to. It's an "An empirical comparison of C, C++, Java, Perl, Python, Rexx", and concludes programs written in scripting languages are shorter (IIRC). -- Michael From delza@blastradius.com Thu Apr 17 18:18:17 2003 From: delza@blastradius.com (Dethe Elza) Date: Thu, 17 Apr 2003 10:18:17 -0700 Subject: [Edu-sig] Lines of code and programmer time... In-Reply-To: <1050545209.3353.16.camel@gopher> Message-ID: <948AFEDE-70F8-11D7-8656-0003939B59E8@blastradius.com> > I seem to remember hearing a few times about a study somewhere that > said > that programmers produce about the same number of lines of code in a > given amount of time regardless of the language. Does anyone know > anything about this study? (or is it a figment of my imagination? :-( Paul Graham, in his article "Succinctness is Power"[1] attributes the general idea you're talking about to Fred Brooks "The Mythical Man-Month." I don't see a specific quote, however. In "Patterns of Software," Richard Gabriel makes a important corrolary point. He refers to Compression rather than Succinctness, and compares it to the way language is used in poetry to generate multiple meanings. But he warns that compression without habitability (another important feature he discusses) leads to write-only languages (I'm paraphrasing liberally). In other words, taking succinctness as the only measure leads to Perl %-) Graham's article is a response to something Paul Prescod wrote, namely, "Python's goal is regularity and readability, not succinctness," which Graham translates as "Python's goal is regularity and readability, not power." My take on it would be "Python's goals emphasize regularity and readability (habitability) over succinctness (compression)." Python is extremely succinct compared to Java, C, or C++, but verbose compared to Perl or Lisp. On the other hand, I've found Python to be easier to read and comprehend than any of those languages. HTH --Dethe From jeff@elkner.net Thu Apr 17 21:48:08 2003 From: jeff@elkner.net (Jeffrey Elkner) Date: 17 Apr 2003 16:48:08 -0400 Subject: [Edu-sig] Lines of code and programmer time... In-Reply-To: <200304171515.h3HFFld23142@odiug.zope.com> References: <200304171515.h3HFFld23142@odiug.zope.com> Message-ID: <1050612487.2068.3.camel@gopher> Thanks a 10**6 to everyone who replied! Jeremy found the quote I was looking for and Guido sent it my way (what a community! ;-) jeff elkner yorktown high school arlington, va btw. I'll put whatever I come up with on my website so anyone interested can check it out. On Thu, 2003-04-17 at 11:15, Guido van Rossum wrote: > Here's a source for your quote. > > PL/I As a Tool for System Programming > by F. J. Corbat > http://home.nycap.rr.com/pflass/plisprg.htm > > It's our experience that regardless of whether one is dealing with > assembly language or compiler language, the number of debugged lines > of source code per day is about the same! > > I think Fred Brooks says something similar in The Mythical Man Month. > > Jeremy From urnerk@qwest.net Thu Apr 17 22:05:45 2003 From: urnerk@qwest.net (Kirby Urner) Date: Thu, 17 Apr 2003 14:05:45 -0700 Subject: [Edu-sig] More advocacy around Math + Computers in K-12 In-Reply-To: <1050612487.2068.3.camel@gopher> References: <200304171515.h3HFFld23142@odiug.zope.com> <1050612487.2068.3.camel@gopher> Message-ID: <200304171405.45308.urnerk@qwest.net> I've just published a rather lengthy essay to math-teach @ The Math Forum= =20 here: http://www.mathforum.org/epigone/math-teach/whaiflaldkrir This installment only mentions Python in passing, but what I'm leading up= to=20 is that we need to draw stuff on the computer screen using coordinate=20 geometry to make a dry topic come alive. I argue that graphing calculato= rs,=20 for all their merits, just don't cut it. Of course there're lots of ways to go about this (I'm probably going to f= ocus=20 on Povray, VRML, SVG and OpenGL -- I'm very open to other suggestions) an= d=20 Python has a role to play in any of them. My focus in this first installment is more a narrative of where we've bee= n=20 since the 1980s (Logo, the flavors of OS, advent of the GUI), and what=20 infrastructure choices (in terms of hardware) are now facing many schools= in=20 2003. =20 =46rom those of you who spare the time to look it over, I welcome any fee= dback=20 or related insights, thoughts or experiences. I'm not a classroom teache= r or=20 school administrator myself (have been in the past, have friends who are)= , so=20 one concern of mine is that I remain in touch with reality to whatever de= gree=20 possible -- recognizing that it's a heterogenous situation to begin with,= =20 i.e. what's going on in Portland, Oregon may not be representative (but i= t's=20 still part of what's going on). Kirby From Herbert.W.Schilling@nasa.gov Fri Apr 18 12:55:28 2003 From: Herbert.W.Schilling@nasa.gov (Herb Schilling) Date: Fri, 18 Apr 2003 07:55:28 -0400 Subject: [Edu-sig] Lines of code and programmer time... In-Reply-To: References: Message-ID: >On 16 Apr 2003 22:06:49 -0400, Jeffrey Elkner wrote: > >>Hi All, >> >>I seem to remember hearing a few times about a study somewhere that said >>that programmers produce about the same number of lines of code in a >>given amount of time regardless of the language. Does anyone know >>anything about this study? (or is it a figment of my imagination? :-( >> Hi, Is this what you are looking for? http://www.theadvisors.com/langcomparison.htm -- Herb Schilling NASA Glenn Research Center Brook Park, OH 44135 Herbert.W.Schilling@nasa.gov Let us permit nature to have her way. She understands her business better than we do. - Michel de Montaigne From ajsiegel@optonline.net Wed Apr 23 15:43:00 2003 From: ajsiegel@optonline.net (Arthur) Date: Wed, 23 Apr 2003 10:43:00 -0400 Subject: [Edu-sig] Pytoon? Message-ID: <000901c309a6$a3d25ec0$0c02a8c0@Arts> A recent powerpoint which looks to be proposing a web-based (via XML) architecture for an animation tool in Python to be used in an educational setting, mentioning, along the way, jython, VPython, Numeric, wxPython, Zope and Plone, Boa, PyGame. http://www.mas.ecp.fr/labo/equipe/devuyst/anim/AnimationII.ppt Mouthwatering. But in French. Can anyone help with a better overview and the specifics of the proposal and its setting? Art From hancock@anansispaceworks.com Wed Apr 23 16:38:23 2003 From: hancock@anansispaceworks.com (Terry Hancock) Date: Wed, 23 Apr 2003 08:38:23 -0700 Subject: [Edu-sig] Pytoon? In-Reply-To: <000901c309a6$a3d25ec0$0c02a8c0@Arts> References: <000901c309a6$a3d25ec0$0c02a8c0@Arts> Message-ID: On Wednesday 23 April 2003 07:43 am, Arthur wrote: > A recent powerpoint which looks to be proposing a web-based (via XML) > http://www.mas.ecp.fr/labo/equipe/devuyst/anim/AnimationII.ppt also in PDF: http://www.mas.ecp.fr/labo/equipe/devuyst/anim/AnimationII.pdf Someday, people will start practicing what they preach and use open-source formats to present open-source topics. ;-) > architecture for an animation tool in Python to be used in an educational > setting, mentioning, along the way, jython, VPython, Numeric, wxPython, Zope > and Plone, Boa, PyGame. Yes, pages 1-12 at least are basically an overview of stuff you already know about: PyGame, VPython, PyOpenGL, and other libraries. It also mentions the ease of doing web integration and other tasks in Python ("Python can do anything" it says). > Can anyone help with a better overview and the specifics of the proposal and > its setting? Mind you my French is rusty, but basically it proposes building an integrated animation tool in Python. He's using Boa Constructor as a GUI design guide I think ("project to follow"), and web capability would be built into the system. He seems to be suggesting a server-side-mostly solution (though I personally think such a beast needs to be client-side-mostly). I could be wrong on this point, because the diagram isn't rendering correctly in gv and kpresenter can't open the PPT on my machine (memory issues? this is a pretty old system). You should look at the diagram on page 17 -- I don't think the labels are particularly cryptic. There's also a sample of a proposed XML modelling format, which is not really transparent to me, but is easy enough to imagine. Like most presentations, it doesn't really get into the meat of the matter -- it's just an idea at this point. Cheers, Terry -- Terry Hancock ( hancock at anansispaceworks.com ) Anansi Spaceworks http://www.anansispaceworks.com From villate@gnu.org Wed Apr 23 23:28:52 2003 From: villate@gnu.org (Jaime E . Villate) Date: Wed, 23 Apr 2003 23:28:52 +0100 Subject: [Edu-sig] Pytoon? In-Reply-To: ; from hancock@anansispaceworks.com on Wed, Apr 23, 2003 at 08:38:23AM -0700 References: <000901c309a6$a3d25ec0$0c02a8c0@Arts> Message-ID: <20030423232852.D392@fe.up.pt> On Wed, Apr 23, 2003 at 08:38:23AM -0700, Terry Hancock wrote: > > Someday, people will start practicing what they preach and > use open-source > formats to present open-source topics. ;-) > > > architecture for an animation tool in Python to be used > in an educational > > setting, mentioning, along the way, jython, VPython, > Numeric, wxPython, Zope > > and Plone, Boa, PyGame. That presentation reminded me of some other project which we recently received in Savannah, and which might be of interest to the subscribers of this list: http://savannah.nongnu.org/projects/modelbuilder In fact, we receive a lot of new project registrations dealing with Python, wxPython, PyNumeric, etc. That's a good measure of Python's success. I will try to keep you posted on interesting new projects in Savannah. Regards, Jaime From ajsiegel@optonline.net Thu Apr 24 14:04:14 2003 From: ajsiegel@optonline.net (Arthur) Date: Thu, 24 Apr 2003 09:04:14 -0400 Subject: [Edu-sig] re: Pytoon? Message-ID: <000501c30a62$02582630$0c02a8c0@Arts> Terry writes - > He seems to be suggesting a server-side-mostly solution (though I personally think >There's also a sample of a proposed XML modelling format, which is not really transparent to me, but is easy enough to imagine. >Like most presentations, it doesn't really get into the meat of the matter -- it's just an idea at this point. One of the reasons I was excited about this project is the fact that I am and have been trying to get a handle on the possiblities for web-based (ideally interactive) graphics that do not rely on Java. I know I could do what I am imagining in Java - have actually implemented a simple version some time ago. But as always, I'm in it for the fun. Getting the basics of Java under my belt was fun. Going back to it doesn't sound like fun. I assume that a CPython solution - if one exists - would involve some networking and or XML technical understanding that I don't presently have. Though pursuing that learning curve with some specific goals *does* sound like fun, but only if I had a better conceptual starting point. I would even be willing, at least in theory, to host my own server if that is what it took. Lee Harr's (Savannah hosted) PyGame based project http://savannah.nongnu.org/projects/pygsear/ - specifcally aimed at kids - demonstrates using PyGame over a network using Twisted. And I think I understand that Twisted roots are in multi-player gaming. Anybody willing to do a paragraph or 2 tutorial on the possiblities. I don't feel bad asking at this point, having spun enough wheels exploring on my own, and still somehow not getting it. Any step beyond animated gifs would be a step in the right direction for what I am after. Art From hancock@anansispaceworks.com Thu Apr 24 22:51:40 2003 From: hancock@anansispaceworks.com (Terry Hancock) Date: Thu, 24 Apr 2003 14:51:40 -0700 Subject: [Edu-sig] re: Pytoon? In-Reply-To: <000501c30a62$02582630$0c02a8c0@Arts> References: <000501c30a62$02582630$0c02a8c0@Arts> Message-ID: On Thursday 24 April 2003 06:04 am, Arthur wrote: > One of the reasons I was excited about this project is the fact that I am > and have been trying to get a handle on the possiblities for web-based > (ideally interactive) graphics that do not rely on Java. > [...] > I assume that a CPython solution - if one exists - > [...] > Lee Harr's (Savannah hosted) PyGame based project > http://savannah.nongnu.org/projects/pygsear/ - > [...] > Anybody willing to do a paragraph or 2 tutorial on the possiblities. I have posted about the possibility of a Python Applet Player infrastructure to deploy C-Python applets (maybe built on PyGame?) and on the possibility of Jython-based applets that could be deployed to be used without needing plugins on existing browsers, both on the python ML and on the pygame ML. You can check the archives for what was said on the subject -- look for "python plugin" or "python applet" to find the threads. This was in 4th qtr 2002. I wrote a summary of my research on this and some of the discussion on the Python ML (which really just outlines the problem -- but you'll probably be interested in some of the links and discussion): http://www.narya.net/client_html which is slightly out of date and focused on my specific needs, but should include some information that would be of use to you. Particularly, the diagram at the top summarizes the blocks you need to build this (really 4 different solutions), and what their status is. I do have time blocked during the next six months to tackle this problem, BTW, but that'll be focused on making a PyUI renderer for Jython/Java 1.0. I have an old book on the Netscape Plugin SDK (v4?), and it apparently hasn't changed much -- I presume that by combining that with the embedding tutorial for the Python interpreter, and using the SDL library for the actual graphics, and PyGame for the Python API, it should be possible to write a plugin system. But it's probably more than I have time to complete during this year (I have to do several other impossible things first). I will cheer enthusiastically for anyone else who wants to attempt it, though! ;-) You should also be aware of the "pythonpoint" package which is part of Report Lab. This creates presentations in PDF format, and requires Acrobat Reader to display (non-free). Note, however, that the XML presentation language that it reads could be interpreted by other applications to present the material without Acrobat Reader (e.g. in a hypothetical pygame-based plugin). Pygame and various components are a very solid basis for a 2D animation system (and possibly 3D too?), from what I've seen. Cheers, Terry -- Terry Hancock ( hancock at anansispaceworks.com ) Anansi Spaceworks http://www.anansispaceworks.com From hancock@anansispaceworks.com Thu Apr 24 23:27:10 2003 From: hancock@anansispaceworks.com (Terry Hancock) Date: Thu, 24 Apr 2003 15:27:10 -0700 Subject: [Edu-sig] re: Pytoon? In-Reply-To: References: <000501c30a62$02582630$0c02a8c0@Arts> Message-ID: On Thursday 24 April 2003 02:51 pm, Terry Hancock wrote: > I have posted about the possibility of a Python Applet > [...] Specifically: http://aspn.activestate.com/ASPN/search?query=applet&list_name=pygame-users&type=Archive_pygame-users_list&top=20&summaries=1&start=0 and http://mail.python.org/pipermail/python-list/2002-October/128179.html http://mail.python.org/pipermail/python-list/2002-October/128242.html (+ followups) http://mail.python.org/pipermail/python-list/2002-November/128418.html http://mail.python.org/pipermail/python-list/2002-November/128425.html I have my summary on the applet/plugin idea at: http://www.narya.net/client_html and the project it's for is of course: http://www.narya.net Happy browsing, ;-) Terry -- Terry Hancock ( hancock at anansispaceworks.com ) Anansi Spaceworks http://www.anansispaceworks.com From ajsiegel@optonline.net Fri Apr 25 13:57:48 2003 From: ajsiegel@optonline.net (Arthur) Date: Fri, 25 Apr 2003 08:57:48 -0400 Subject: [Edu-sig] re: pytoon Message-ID: <3EA930CC.9020002@optonline.com> >I have posted about the possibility of a Python Applet Player infrastructure to deploy C-Python applets (maybe >built on PyGame?) and following cites. Lot's to digest. Please keep us/me posted. I will probably have some specific questions once I have had a chance to digest more. Off to the side - maybe you/ others might save me from going down a dead-end. Is there anything in this general area that might be put together using xmlrpc and/or SVG? I am specifically interested in 3d stuff. But the 3d functionality I need is quite basic - just a few primtives to work with - spheres, lines, etc. Essentially what is native to VPython, which is why it has been such a fortuitous match to my needs. I guess my understanding is that SVG is not natively 3d, but I have seem some demos of decent, but basic 3d web-based SVG renderiong. Python libraries exist that would handle all this well, I believe, if there is anything feasible to be done here. ? Art From delza@blastradius.com Fri Apr 25 17:20:58 2003 From: delza@blastradius.com (Dethe Elza) Date: Fri, 25 Apr 2003 09:20:58 -0700 Subject: [Edu-sig] 3D in Python (was Re: Pytoon) In-Reply-To: <3EA930CC.9020002@optonline.com> Message-ID: Art, Is there any reason you can't drive VPython with XML-RPC? Why do you need SVG? SVG is an inherently 2-D format, basically display PostScript with angle brackets. While you can certainly generate 3D on such a platform (it all ends up in 2D at some point), it's a serious load of work (I did a simple 3D app using nothing but Java AWT and it was a pain in the keister), and (perhaps more importantly) you lose all the efficiencies of OpenGL (which is mostly rendered in specialized hardware these days). If you have a need for 3D using XML, I'd recommend taking a look at X3D[1] from the Web3D Consortium, and the standards which build on it: GeoVRML[2] for specifying large, outdoor scenes, and H-Anim[3] for humanoid animation. X3D is the re-working of VRML in XML, and while VRML has a bad rep for being inconsistently implemented, it still presents one of the lower barriers to entry of the 3D standards. By using XML for 3D you also get access to the standard XML DOM for manipulations and animation (which can be good or bad, depending on your feelings about the DOM). On the other hand, if you need to do 3D beyond what VPython provides, but you don't care about the XML aspect of SVG, there quite a number of tools for 3D which have Python bindings. The grand-daddy of them all is PyOpenGL[4], which gives you complete access to the native OpenGL API (an absolute beast, but it does the job). The PyOpenGL project also has a subproject, OpenGLContext[5], which is a learning environment for OpenGL, much more accessible than raw OpenGL (closer to VPython), and has a tool for importing VRML documents. Other 3D Libraries with Python bindings include VTK[6], CrystalSpace[7], Blender[8], and on the commercial front the Poser[9] character animation program (version 5) is scriptable with Python. [1] Extensible 3D Graphics http://www.web3d.org/x3d.html [2] Geographical Data in VRML http://www.geovrml.org/ [3] Specification for a standard humanoid http://www.h-anim.org/Specifications/H-Anim1.1/ [4] The Python OpenGL Binding http://pyopengl.sourceforge.net/ [5] A Learning Environment for PyOpenGL and Python 2.2.x http://pyopengl.sourceforge.net/context/index.html [6] The Visualization Toolkit http://www.vtk.org/ [7] CrystalSpace game development kit http://crystal.sourceforge.net/drupal/ [8] Blender 3D http://www.blender3d.com/ [9] Poser 5 Character Animation Solution http://www.curiouslabs.com/ --Dethe On Friday, April 25, 2003, at 05:57 AM, Arthur wrote: >> I have posted about the possibility of a Python Applet Player >> infrastructure to deploy C-Python applets (maybe >> built on PyGame?) > > and following cites. > > Lot's to digest. Please keep us/me posted. I will probably have some > specific questions once I have had a chance to digest more. > > Off to the side - maybe you/ others might save me from going down a > dead-end. Is there > anything in this general area that might be put together using xmlrpc > and/or SVG? I am > specifically interested in 3d stuff. But the 3d functionality I need > is quite basic - just > a few primtives to work with - spheres, lines, etc. Essentially what > is native to VPython, > which is why it has been such a fortuitous match to my needs. I guess > my understanding is > that SVG is not natively 3d, but I have seem some demos of decent, but > basic 3d web-based SVG renderiong. > > Python libraries exist that would handle all this well, I believe, if > there is anything > feasible to be done here. > > ? > > Art > > > > > _______________________________________________ > Edu-sig mailing list > Edu-sig@python.org > http://mail.python.org/mailman/listinfo/edu-sig > From ajsiegel@optonline.net Sat Apr 26 00:59:55 2003 From: ajsiegel@optonline.net (Arthur) Date: Fri, 25 Apr 2003 19:59:55 -0400 Subject: [Edu-sig] re: 3d in Python Message-ID: <3EA9CBFB.9090300@optonline.com> Dethe asks: >Is there any reason you can't drive VPython with XML-RPC? Why do you need SVG? That's really the question I am tryin to get to - is that a possiblity worth investigating. VPython is all the 3d functionality I really require - though there is always a wish list. But XML-RPC is little more than an acronym to me at this point. *If I knew, or at least had reason to believe, that I could in fact drive VPython remotely with XML-RPC, I'd dig in. Can I take you post as an opinion that there is something to be done along these lines? Can you describe how it might be configured/architected - in very, very broad terms? Most of the other tools you refer to, I am familiar with. It was actually through PyOpenGL that I became aware of and involved with using Python. My interest was in learning to work with the OpenGL API without wading through all kinds of windowing APIs to get there. The insanity one needs to go through to get a Windows window prepared for an OpenGL dot, is almost funny. Anti-intuitive is an understatment. The code, to me, looks like a random letter generator at work. Most of the other apps and APIs you reference are overkill for my needs. VTK is awesome, but considerably more than I require. Art * From tjd@sfu.ca Sat Apr 26 02:13:50 2003 From: tjd@sfu.ca (Toby Donaldson) Date: Fri, 25 Apr 2003 18:13:50 -0700 Subject: [Edu-sig] Python as a first-year programming language Message-ID: <007901c30b91$18a81d20$7a64390a@techbc.local> This is a multi-part message in MIME format. ------=_NextPart_000_007A_01C30B56.6C494520 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Hi all, I've been lurking on this list for a few months now, and thought it was finally time to say hello. I am interested in Python as a first language for first-year university students, including students who are not planning to major in computer science or engineering or some other technical field. As a warm-up for trying to convince colleagues of the merits of Python, I've written an advocacy paper, which you can read at http://www.cs.ubc.ca/wccce/Program03/papers/Toby.html (it's a presentation at WCCCE http://www.cs.ubc.ca/wccce/index.html). There's probably nothing new in it to people on this list. I found that actually writing Java equivalents was quite an interesting exercise, and a good way to really see the differences between Python and Java. One of the problems I have about acceptance of Python is that the choice of first-year programming language is likely to be a group decision, and Python, for all its merits, is either unknown, or has a reputation as being "just a scripting language", or just a new version of BASIC. Such innuendos unfortunately often carry the day in many academic departments, as nobody but the teachers of the programming class will have time to actually evaluate the different languages. Who says academia has no pointy-haired bosses? :-) One strategy I have been trying out is to pitch Python as a sort of practical version of Scheme. Computer scientists love functional programming, so to tell them that Python has lambda expressions and list comprehensions is an easy (if underhanded) way to get them to take it seriously. Plus, I've pointed out to people that Python has some similarities to the language that Edsgar Dijkstra uses in his classic A Discipline of Programming. Also, we are developing a set of exercises and answers for How to Think Like a Computer Scientist, the on-line Python programming text. I have become rather disillusioned with the objects-first way of teaching programming, and really like its straightforward, bottom-up approach. Plus, the brevity of the text itself is a refreshing change from the 1000 page pulp bombs that constitute most programming textbooks. I've reviewed a number of Java books recently, and they're splattered with special boxes and tags to point out programming rules, interesting facts, etc. The clutter of some of these books is truly remarkable. Good things students don't read them. :-) Toby -- Dr. Toby Donaldson, Assistant Professor tjd@sfu.ca, www.sfu.ca Simon Fraser University 2400 Surrey Place,10153 King George Hwy Surrey, BC V3T 2W1, Phone: 604.268 7433, Fax: 604.586 5237 ------=_NextPart_000_007A_01C30B56.6C494520 Content-Type: text/html; charset="US-ASCII" Content-Transfer-Encoding: quoted-printable

    Hi all,

     

    I’ve been lurking on this list for a few months = now, and thought it was finally time to say = hello.

     

    I am interested in Python as a first language for = first-year university students, including students who are not planning to major in computer science or engineering or some other technical = field.

     

    As a warm-up for trying to convince colleagues of the = merits of Python, I’ve written an advocacy paper, which you can read at = http://www= .cs.ubc.ca/wccce/Program03/papers/Toby.html (it’s a presentation at WCCCE http://www.cs.ubc.ca/wccce= /index.html). There’s probably nothing new in it to people on this list. I found = that actually writing Java equivalents was quite an interesting exercise, and a good = way to really see the differences between Python and = Java.

     

    One of the problems I have about acceptance of Python = is that the choice of first-year programming language is likely to be a = group decision, and Python, for all its merits, is either unknown, or has a reputation as being “just a scripting language”, or just a = new version of BASIC. Such innuendos unfortunately often carry the day in = many academic departments, as nobody but the teachers of the programming = class will have time to actually evaluate the different languages. Who says = academia has no pointy-haired bosses? J

    One strategy I have been trying out is to pitch Python = as a sort of practical version of Scheme. Computer scientists love functional programming, so to tell them that Python has lambda expressions and list comprehensions is an easy (if underhanded) way to get them to take it seriously. Plus, I’ve pointed out to people that Python has some similarities to the language that Edsgar Dijkstra uses in his classic A Discipline of Programming.

    Also, we are developing a set of exercises and answers = for How to Think Like a Computer Scientist, the on-line Python programming = text. I have become rather disillusioned with the objects-first way of teaching = programming, and really like its straightforward, bottom-up approach. Plus, the = brevity of the text itself is a refreshing change from the 1000 page pulp bombs = that constitute most programming textbooks. I’ve reviewed a number of = Java books recently, and they’re splattered with special boxes and tags = to point out programming rules, interesting facts, etc. The clutter of some of = these books is truly remarkable. Good things students don’t read them. = J<= /span>

    Toby
    --
    Dr. = Toby = Donaldson, Assistant = Professor
    tjd@sfu.ca, www.sfu.ca
    Simon = Fraser = University
    2400 Surrey = Place,10153 King = George Hwy
    Surrey, = BC<= font size=3D2> = V3T = 2W1, Phone: = 604.268 7433, Fax: 604.586 5237

     

    ------=_NextPart_000_007A_01C30B56.6C494520-- From delza@blastradius.com Sat Apr 26 04:11:57 2003 From: delza@blastradius.com (Dethe Elza) Date: Fri, 25 Apr 2003 20:11:57 -0700 Subject: [Edu-sig] re: 3d in Python In-Reply-To: <3EA9CBFB.9090300@optonline.com> Message-ID: Arthur wrote: > Dethe asks: > >> Is there any reason you can't drive VPython with XML-RPC? Why do you >> need SVG? > > That's really the question I am tryin to get to - is that a possiblity > worth investigating. > VPython is all the 3d functionality I really require - though there is > always a wish list. Yes, my wish list for VPython is: * Runs native on OS X (instead of in X Windows) * Transparency (alpha channel) * Textures * Built as part of PyOpenGL, so I can embed it in wxWindows, GLUT, etc. > But XML-RPC is little more than an acronym to me at this point. *If I > knew, or at least had reason to believe, that I could in fact drive > VPython remotely > with XML-RPC, I'd dig in. XML-RPC is just one of a plethora of ways to connect programs over the net. There's a full-featured toolkit for building network-savvy programs in Python, called Twisted[1], but it may be overkill for what you want. XML-RPC is pretty simple, and you don't have to know much to use it. There was even a new version released today[2] which is supposed to be 10 times faster (implemented in C, with Python bindings). > Can I take you post as an opinion that there is something to be done > along these lines? I can't think of a reason why not. > Can you describe how it might be configured/architected - in very, > very broad terms? Yes, but it would be easier if I had a better idea what you're trying to accomplish. > Most of the other tools you refer to, I am familiar with. > It was actually through PyOpenGL that I became aware of and involved > with using Python. > My interest was in learning to work with the OpenGL API without wading > through all kinds > of windowing APIs to get there. The insanity one needs to go through > to get a Windows > window prepared for an OpenGL dot, is almost funny. Anti-intuitive is > an understatment. Yes. Somewhat easier if you use GLUT (a cross-platform windowing toolkit for OpenGL), but still pretty hairy. I mentioned OpenGLContext because it is supposed to be a friendlier environment. It features windowing using wxWindows, GLUT, Tkinter, etc., for one thing, and I believe it is object-oriented, for another. But I haven't really explored it much. > The code, to me, looks like a random letter generator at work. > Most of the other apps and APIs you reference are overkill for my > needs. VTK is awesome, but considerably more than I require. Yes, the only reason to use one of those is if it gives you something you need that you can't get from VPython. If VPython is sufficient, but you just want to hook it up to the network, that should be relatively straightforward. I'd be happy to help, if you can supply another level of detail. > Art [1] Twisted Network Framework http://www.twistedmatrix.com/ [2] Py-xmlrpc 0.8.8.3 released http://sourceforge.net/forum/forum.php?forum_id=270940 --Dethe From ajsiegel@optonline.net Sat Apr 26 14:43:57 2003 From: ajsiegel@optonline.net (Arthur) Date: Sat, 26 Apr 2003 09:43:57 -0400 Subject: [Edu-sig] re: 3d in Python In-Reply-To: References: Message-ID: <3EAA8D1D.70206@optonline.com> Dethe Elza wrote: > Yes, my wish list for VPython is: > * Runs native on OS X (instead of in X Windows) > * Transparency (alpha channel) > * Textures > * Built as part of PyOpenGL, so I can embed it in wxWindows, GLUT, etc. Textures and transparency have been discussed a lot on the list. David Scherer has explained to me at least twice why the transparency issue is a lot more complicated than adding an alpha channel to the glColor calls in the C code. Depth cuing, or something. I of course don't fully get it. There are, finally, some specific plans to bring VPython forward and add new features. I understand the first step will be a port from CXX to Boost. "Built as part of PyOpenGL" kind of scares me, because it somehow implies to me the possibility of losing VPythons immediacy at the interactive prompt. There is actually *no* windowing code necessary in VPython. sphere() not only creates the sphere, but its display context. The creation of additional objects will proceed on that same display, until a new display window is explicitly created. > Yes, but it would be easier if I had a better idea what you're trying > to accomplish. Ideally, try before you buy. In some way, shape or form. For those outside the Python orbit, the the concept of the dependencies of something like VPython seems daunting. Seems to me that folks want to understand the functionality beyond what screenshots can provide, before they commit to the effort. Telling them that VPython is "3d for mortals" is one thing. Showing them, another. > Yes. Somewhat easier if you use GLUT (a cross-platform windowing > toolkit for OpenGL), but still pretty hairy. I mentioned > OpenGLContext because it is supposed to be a friendlier environment. > It features windowing using wxWindows, GLUT, Tkinter, etc., for one > thing, and I believe it is object-oriented, for another. But I > haven't really explored it much. I had the pleasure of talking with Mike Fletcher, who I think is doing most of the OpenGLContext work, at PyCon. But even before OpenGLContext, there was a pre-built Tkinter default display context, that provided simple mouse interactivity, and that became available by a simple import statement. It is actually a good intro to OOP, as one begins to understand that inheriting from and overriding a method or 2 in the default display context is how one draws one's own OpenGL construction. > Yes, the only reason to use one of those is if it gives you something > you need that you can't get from VPython. If VPython is sufficient, > but you just want to hook it up to the network, that should be > relatively straightforward. I'd be happy to help, if you can supply > another level of detail. VPython is sufficient, and will hopefully become *more* sufficient over time. What would you suggest as a starting point for some experimentation for a remotely accessed VPython - which something other than a telnet type session? Art From ajsiegel@optonline.net Sat Apr 26 14:59:03 2003 From: ajsiegel@optonline.net (Arthur) Date: Sat, 26 Apr 2003 09:59:03 -0400 Subject: [Edu-sig] re: Python as a first-year programming language Message-ID: <3EAA90A7.5070508@optonline.com> Toby writes - >One of the problems I have about acceptance of Python is that the choice >of first-year programming language is likely to be a group decision, and >Python, for all its merits, is either unknown, or has a reputation as >being "just a scripting language", or just a new version of BASIC. Such >innuendos unfortunately often carry the day in many academic >departments, as nobody but the teachers of the programming class will >have time to actually evaluate the different languages. Who says >academia has no pointy-haired bosses? :-) Seems to me that the fact that Peter Norwig chose to illustrate the algorythms of Artificial Intelligence: A Modern Approach Second Edition by *StuartRussell * and *PeterNorvig * in Python should say a lot to some of these folks. http://www.norvig.com/python/python.html Art PS Not to worry, I'm handling the errata ;) From Jason Cunliffe" Notes from "Daddy, Are We There Yet?" Alan Kay's talk at O'Reilly Emerging Technology Conference 2003 Cory Doctorow http://craphound.com/kayetcon2003 From tjd@sfu.ca Mon Apr 28 09:37:14 2003 From: tjd@sfu.ca (Toby Donaldson) Date: Mon, 28 Apr 2003 01:37:14 -0700 Subject: [Edu-sig] re: Python as a first-year programming language In-Reply-To: <20030426140002.5930.36994.Mailman@mail.python.org> Message-ID: > >One of the problems I have about acceptance of Python is that the choice > >of first-year programming language is likely to be a group decision, and > >Python, for all its merits, is either unknown, or has a reputation as > >being "just a scripting language", or just a new version of BASIC. Such > >innuendos unfortunately often carry the day in many academic > >departments, as nobody but the teachers of the programming class will > >have time to actually evaluate the different languages. Who says > >academia has no pointy-haired bosses? :-) > > Seems to me that the fact that Peter Norwig chose to illustrate > the algorythms of > > > Artificial Intelligence: A Modern Approach > > > Second Edition > > by *StuartRussell * and > *PeterNorvig * > > in Python should say a lot to some of these folks. > > http://www.norvig.com/python/python.html > > Art > > PS Not to worry, I'm handling the errata ;) The problem with AI is that it is too complex for beginning programmers. I have enough trouble teaching it to graduate students. :-) I've used some of Norvig's code in a planner I've written in Python. It's been *great* for prototyping, like Scheme in many respects, but easier to read and write. Is there any way in Python to implement non-deterministic programming, e.g. for backtacking? It would be nice to be able to write something like this: def triple(a, b, c, n): a = choice(n) # choice non-deterministically chooses a number from 0 to n-1 b = choice(n) c = choice(n) if a**2 + b**2 == c**2: return a, b, c More practically, what would help sell Python as a teaching language at my university is: - good textbooks for it, including exercises with answers, labs, self-tests, etc. (when there's 200+ students in one class, you need self-contained materials) - explanations of the advantags it gives to "CO-OP" students, i.e. students who alternate school terms with work terms; the practicality of Python is key to selling it to student, parents, advisors, and employers, although a common argument is that we should be teaching the exact same languages that CO-OP employers use (I don't agree with that argument, but it's made all the time) - explanations of how it impacts later traditional computer science courses, such as data structures and algorithms, operating systems, graphics, etc.; there's FUD among some that teaching students a "weird" language hurts them in later courses Toby From delza@blastradius.com Mon Apr 28 17:06:58 2003 From: delza@blastradius.com (Dethe Elza) Date: Mon, 28 Apr 2003 09:06:58 -0700 Subject: [Edu-sig] re: 3d in Python In-Reply-To: <3EAA8D1D.70206@optonline.com> Message-ID: <70A5D146-7993-11D7-9AC3-0003939B59E8@blastradius.com> > Textures and transparency have been discussed a lot on the list. > David Scherer has explained to > me at least twice why the transparency issue is a lot more complicated > than adding an alpha > channel to the glColor calls in the C code. Depth cuing, or > something. I of course don't > fully get it. I get how difficult this is. I still want it. %-) > There are, finally, some specific plans to bring VPython forward and > add new features. > I understand the first step will be a port from CXX to Boost. That's probably a good thing. If only it was to port it out of C++ to C I'd be able to participate more. Tracing through dozens of C++ files to find where a method is implemented is one of my least favorite things. > "Built as part of PyOpenGL" kind of scares me, because it somehow > implies to me the possibility > of losing VPythons immediacy at the interactive prompt. There is > actually *no* windowing code > necessary in VPython. sphere() not only creates the sphere, but its > display context. The creation of > additional objects will proceed on that same display, until a new > display window is explicitly created. Yes, and I'd expect the same behaviour from VPython, whether it was part of PyOpenGL or not. I'd like to see it become part of PyOpenGL in part because that is the closest thing to a standard for 3D in Python, and gets ported to more platforms (although their support for OS X has been lagging, it's still better than VPython's). VPython could use GLUT for its windows by default, eliminating a lot of code overhead in the current version, but allow windows to be specified as wxWindows, Tkinter, or whatever by overriding the default. Actually, just making the default windows use GLUT instead of native windows would make my life better (without becoming part of PyOpenGL) because then I could compile and run VPython on OS X. And, interestingly enough, your suggestion for driving VPython remotely opens up some cool solutions for combining VPython with Tkinter, wxWindows, etc. More on this below. > >> Yes, but it would be easier if I had a better idea what you're trying >> to accomplish. > > Ideally, try before you buy. In some way, shape or form. > > For those outside the Python orbit, the the concept of the > dependencies of something like VPython seems > daunting. Seems to me that folks want to understand the functionality > beyond what screenshots can provide, > before they commit to the effort. > > Telling them that VPython is "3d for mortals" is one thing. Showing > them, another. Still not sure what you're looking for, but I'm going to take a stab at it anyway. >> Yes. Somewhat easier if you use GLUT (a cross-platform windowing >> toolkit for OpenGL), but still pretty hairy. I mentioned >> OpenGLContext because it is supposed to be a friendlier environment. >> It features windowing using wxWindows, GLUT, Tkinter, etc., for one >> thing, and I believe it is object-oriented, for another. But I >> haven't really explored it much. > > I had the pleasure of talking with Mike Fletcher, who I think is doing > most of the OpenGLContext work, at PyCon. > > But even before OpenGLContext, there was a pre-built Tkinter default > display context, that provided simple mouse interactivity, > and that became available by a simple import statement. It is > actually a good intro to OOP, as one begins to understand that > inheriting from and overriding a method or 2 in the default display > context is how one draws one's own OpenGL construction. > >> Yes, the only reason to use one of those is if it gives you something >> you need that you can't get from VPython. If VPython is sufficient, >> but you just want to hook it up to the network, that should be >> relatively straightforward. I'd be happy to help, if you can supply >> another level of detail. > > > VPython is sufficient, and will hopefully become *more* sufficient > over time. > What would you suggest as a starting point for some experimentation > for a remotely accessed VPython - which something other than a > telnet type session? > Well, I have a demo program for VPython, a collection of shapes that show off vertices, edges, and faces for polyhedra and spirals. It was getting too big, and some of the shapes take a long time to load, so I added a buttload of command-line flags. Another approach would be to add a control window with checkboxes and lists to select aspects of the demo, but I didn't really want to take that on in the context of VPython. Your question gave me an "Aha!" moment, because if I wire the VPython demo up to XML-RPC (or any other RPC-like mechanism), then I can drive the demo from Tkinter, or a web page, or command-line access to the running program. So I'm going to try that. I haven't had a running VPython for some time, since my hard drive crashed a few months ago and I've been reluctant to install Fink and all the other cruft needed to get VPython running on OS X under X Windows. But I'll spend some time today to get it running, polish up the demo (the code needs a bit of TLC), and wire up some remote features. I should have something to show by the end of the week. Does that sound anything like what you're looking for? > Art --Dethe From urnerk@qwest.net Mon Apr 28 17:29:20 2003 From: urnerk@qwest.net (Kirby Urner) Date: Mon, 28 Apr 2003 09:29:20 -0700 Subject: [Edu-sig] re: Python as a first-year programming language In-Reply-To: References: Message-ID: <200304280929.20979.urnerk@qwest.net> On Monday 28 April 2003 01:37 am, Toby Donaldson wrote: > > >One of the problems I have about acceptance of Python is that the choice > > >of first-year programming language is likely to be a group decision, and > > >Python, for all its merits, is either unknown, or has a reputation as > > >being "just a scripting language", or just a new version of BASIC. Such > > >innuendos unfortunately often carry the day in many academic > > >departments, as nobody but the teachers of the programming class will > > >have time to actually evaluate the different languages. Who says > > >academia has no pointy-haired bosses? :-) Academics can be as prejudiced as anybody, and when it comes to Python, the better faculties won't be trapped by their own ignorance, while the more "out of the loop know-it-alls" will be. This is nothing new. As you and I know, Python is not a new version of BASIC, isn't "just" a scripting language, and a lot of people have heard of it and some it all the time, in many walks of life. Some academics are just among the last to find out. So it's their problem, really, not ours (ok, ok, bad attitude: people on marketing-python etc. continue to address these issues, but there's only so far one can go with people resolute to remain clueless). > I've used some of Norvig's code in a planner I've written in Python. It's > been *great* for prototyping, like Scheme in many respects, but easier to > read and write. Is there any way in Python to implement non-deterministic > programming, e.g. for backtacking? It would be nice to be able to write > something like this: > > def triple(a, b, c, n): > a = choice(n) # choice non-deterministically chooses a number from 0 > to n-1 > b = choice(n) > c = choice(n) > if a**2 + b**2 == c**2: > return a, b, c You're asking if Python can do pseudo-random numbers? Non-deterministically in what sense? The philosophers among us are bound to rage about whether such a thing is even possible (maybe that cosmic ray just *had* to be there -- whatever that means). > More practically, what would help sell Python as a teaching language at my > university is: > > - good textbooks for it, including exercises with answers, labs, > self-tests, etc. (when there's 200+ students in one class, you need > self-contained materials) This is a legitimate need. That Deitel book, Python: How-To-Program uses this format, but has other drawbacks. Very wide-ranging, yet too lazy to mention Zope when getting into server-side programming. On the other hand, there's the "book optional" approach. In the course notes for CS11 at Cal Tech, the prof writes: "Python is sufficiently easy to learn that you don't really need to buy a book to learn it." > - explanations of the advantags it gives to "CO-OP" students, i.e. > students who alternate school terms with work terms; the practicality of > Python is key to selling it to student, parents, advisors, and employers, > although a common argument is that we should be teaching the exact same > languages that CO-OP employers use (I don't agree with that argument, but > it's made all the time) I'm of the school that it's best to learn more than one computer language, as well as more than one operating system, because employers are all over the map and have a variety of needs. I met an executive with a simple need the other day. His web server was kicking back answers to on-line survey questions in a somewhat unusable format. He needed a utility to map answers, one answer per line (userid, question name: value), to a spreadsheet with all questions in order across the top, and those few answered per survey filled in as rows, userids down the side. The poor guy was trying to wrap his mind around coding such a thing in VBA inside Microsoft Access, or as some kind of Excel macro. I came up with a few lines of Python code in an evening, and because Python is a free download, there's nothing more he needs. Now he's already thinking of enhancements, plus is reading through the Python tutorial and appreciating the flexibility that having a generic power tool like this is going to give him. In this example, we actually *are* talking "scripting language" and the truth is: many Windows users aren't used to having one handy (as if DOS batch files were ever really up to true scripting). HP/Compaq machines tend to come with Python pre-installed these days, no doubt because some of their own setup scripts use it. > - explanations of how it impacts later traditional computer science > courses, such as data structures and algorithms, operating systems, > graphics, etc.; there's FUD among some that teaching students a "weird" > language hurts them in later courses > > Toby Python is hardly weird. It's rather straightforward and conservative, which is one of the things people like about it. An agile language, high level and object oriented. Weirder (but still fine languages, worthy of study) would be Haskell, Ocaml, Rebol and J. Yet weird languages *are* used in the business community. J for example: lots of Wall Street types use it for financial analysis, along with it's older brother, APL. Here's an example of a higher level algorithms course at UC Irvine that happens to use Python. Just showing that some universities are going with Python for these kinds of computer science courses, and not regretting the decision: http://www.ics.uci.edu/~eppstein/161/ But still, if you're a CS major, you shouldn't think that learning any *single* language is going to earn you that degree. I mean, to fully grasp Python, you should be able to read its source code, meaning either C or Java (both would be better, and if you know C, you should learn C++, whereas if you know Java, might as well pick up C#). And you'll probably want at least one course that focuses on LISP or Scheme, if your goal is to be well-rounded. The idea that a CS degree just means knowing some VB, a smattering of SQL, and how to use Windows dialogs, is not worth catering to. Kirby PS: I was a philosophy major, not a CS major. From hancock@anansispaceworks.com Mon Apr 28 22:39:25 2003 From: hancock@anansispaceworks.com (Terry Hancock) Date: Mon, 28 Apr 2003 14:39:25 -0700 Subject: [Edu-sig] re: 3d in Python In-Reply-To: <70A5D146-7993-11D7-9AC3-0003939B59E8@blastradius.com> References: <70A5D146-7993-11D7-9AC3-0003939B59E8@blastradius.com> Message-ID: Hi all, Regarding "interactive" VPython on the web, this wouldn't be too hard with a Zope product -- or even just an external method: o HTML form to enter VPython code, and an Image which represents the result. o Type a line of code/VPython-command at the end of the script window. Press a "submit" button. o After a few seconds, get the same form back, with the extra command and the updated image. o Repeat. Naturally, you could add features to make it play back in a less interactive way, a palette to express common function calls etc (i.e. you push the button and the function is typed into the window -- using Javascript -- to remind you of what the syntax looks like), and so on. What it would do is create a browser-based interface to VPython so the user doesn't have to have it installed on their machine. The downside of course, is that you (whoever's running the server) have to pay for all the CPU cycles involved and the bandwidth used is pretty high (because you ship a different image to the browser after every step). So a *good* design would probably consider the overload failure mode you want to see (i.e. what your server should do if there are too many people using it). It might not matter in an academic setting, though (plenty of CPU, large bandwidth, few users). Will VPython run with Python 2.1.3? If it requires 2.2, this would be just a bit harder with the current Zope releases, since AFAIK Zope still needs 2.1. Also, you need to be able to render to an image (i.e. use VPython in a "batch mode") rather than the screen. Does that make sense? Cheers, Terry -- Terry Hancock ( hancock at anansispaceworks.com ) Anansi Spaceworks http://www.anansispaceworks.com From hancock@anansispaceworks.com Mon Apr 28 22:59:18 2003 From: hancock@anansispaceworks.com (Terry Hancock) Date: Mon, 28 Apr 2003 14:59:18 -0700 Subject: [Edu-sig] re: Python as a first-year programming language In-Reply-To: <200304280929.20979.urnerk@qwest.net> References: <200304280929.20979.urnerk@qwest.net> Message-ID: On Monday 28 April 2003 09:29 am, Kirby Urner wrote: > On Monday 28 April 2003 01:37 am, Toby Donaldson wrote: > Is there any way in Python to implement non-deterministic > > programming, e.g. for backtacking? It would be nice to be able to write > > something like this: > > > > def triple(a, b, c, n): > > a = choice(n) # choice non-deterministically chooses a number from 0 > > to n-1 > > b = choice(n) > > c = choice(n) > > if a**2 + b**2 == c**2: > > return a, b, c > > You're asking if Python can do pseudo-random numbers? Assuming that you *did* mean this, Toby, you should be aware that your function can be written almost exactly as you just did: from random import choice def triple(n): a = choice(range(n)) b = choice(range(n)) c = choice(range(n)) if a**2 + b**2 == c**2: return a, b, c Try it. ;-) >>> triple(3) >>> triple(3) (2, 0, 2) >>> triple(3) (1, 0, 1) >>> triple(3) >>> triple(3) (0, 0, 0) I have to admit that I don't understand why you want this (I'm sure there's a good reason, and I'm hoping you'll tell me so I'll know too ;-) ). Is this for some kind of search efficiency reason? I have a feeling you're using theory I never got because I never formally studied programming. Kirby's point of course (due to being a philosopher? ;-) ) is that such numbers aren't *truly* random. Which of course they aren't. But they're "pretty random" -- without knowing the application, I couldn't say if they were "random enough". I have seen Monte Carlo simulation applications which required *incredibly* well-distributed random numbers with no cycles less than several billion (we were doing forward-ray-tracing of billions of simulated photons to build up enough to create an image -- you have to do this in the forward direction rather than the usual reverse ray tracing in some scientific applications). I was actually surprised to find out that random number algorithms that good exist! Cheers, Terry -- Terry Hancock ( hancock at anansispaceworks.com ) Anansi Spaceworks http://www.anansispaceworks.com From ajsiegel@optonline.net Tue Apr 29 03:41:16 2003 From: ajsiegel@optonline.net (Arthur) Date: Mon, 28 Apr 2003 22:41:16 -0400 Subject: [Edu-sig] re: 3d in Python In-Reply-To: <70A5D146-7993-11D7-9AC3-0003939B59E8@blastradius.com> References: <70A5D146-7993-11D7-9AC3-0003939B59E8@blastradius.com> Message-ID: <3EADE64C.7010303@optonline.com> Dethe writes - > That's probably a good thing. If only it was to port it out of C++ to C > I'd be able to participate more. Tracing through dozens of C++ files to > find where a method is implemented is one of my least favorite things. Can't speak to C vs. C++. What I am aeware of is the following: I believe the VPython project has some funding, and there is at least one student proficient in C++ actively focused on it. There is another student, I believe, in New Zealand, who is working on extending it, in interesting ways (it sounds like), I believe as part of some thesis work. He has not released code yet. I think he feels constrained until either his thesis work is complete and accepted, or until he gets some necessary premissions from his institution. But he expects to be able to do so at some point. Back to C vs C++. It does seem to me that if ported as a pure C extension, there would be the possibility of VPython eventually included in the core distro. Were it not for its semi-dependency on Numeric, I would be lobbying for that direction. But I wouldn't be surprised to see some multi-dimensional array capabilities in the core distribution in the not too distant future, so that a VPython in the core distribution could be a real possiblity. As a bonus, the possbility could give me something new to fight with Guido about. ;) Are you on the vpython-users list? Things are pretty much in a kicking around ideas stage. And you're sugestions - a pure C extension, "plays better" with PyOpenGL - seem consistent with ideas that David Scherer has put out there. Though it doesn't seem David is in a position to devote energies to implementation work. And as a practical matter, those who are, seem to be more C++ than C folks. Though that issue has not been addressed head-on as far as I am aware. The slated port to Boost is partly my doing, only in the sense that I pointed out that Paul Dubois, the CXX develper, himself points to Boost as a better alternative for new projects than his CXX library. And one of the goals of the port is not just to go from CXX to Boost, but to simplify and "dequirkify" the code some - making it more realistic for the project to go forward as collaberative, participatory Open Source. It also seems like it is going to be necessary to transition from Numeric to Numarray, and from gtkglarea (providing the OpenGL context for GTK, on Linux) to another library which is superceding it (this, again, being the general recommendation of the gtkglarea developer himself). (Aha, GLUT, he says) So there is much to be done just to stay even, in some sense. But I am getting confident that more than that will get accomplished. > Yes, and I'd expect the same behaviour from VPython, whether it was part > of PyOpenGL or not. I'd like to see it become part of PyOpenGL in part > because that is the closest thing to a standard for 3D in Python, and > gets ported to more platforms (although their support for OS X has been > lagging, it's still better than VPython's). VPython could use GLUT for > its windows by default, eliminating a lot of code overhead in the > current version, but allow windows to be specified as wxWindows, > Tkinter, or whatever by overriding the default. Again, please jump in on the list. There is more flexiblity in thinking there than had been. Though, prelimininarily, I would probably be on the side of "plays better" with PyOpenGL, rather than "become part of PyOpenGL". And that is probably a more realistic shorter term goal. Is the fact that PyOpenGL Swig, and VPython CXX, moving, it looks like, to Boost, an impediment to even a "plays better" status? > > Actually, just making the default windows use GLUT instead of native > windows would make my life better (without becoming part of PyOpenGL) > because then I could compile and run VPython on OS X. There are a number of distribution semi-nightmares arising out of the different windowing dependecies under Windows and under Linux. On the other hand GLUT doesn't seem to be part of the core Linux distros, nor part of Windows - so its does present something of a distribution problem. I know Bruce Sherwood is trying to keep the distribution as simple as possible, but fighting something of an uphill battle in any case due to shifting sands. And since there doesn't, at the moment seem to be any really good and easy solution, maybe the GLUT solution is the lesser of "evils". And when one is talking aobut education and about graphics, it does seem unwise to short shrift Mac. So, yes, it seems to me like it should be brought up. I can do it, but you can do it with more authority. In fact maybe the simplest way to bring it up is to copy vython-users on this exchange. What do you think? > > Well, I have a demo program for VPython, a collection of shapes that > show off vertices, edges, and faces for polyhedra and spirals. It was > getting too big, and some of the shapes take a long time to load, so I > added a buttload of command-line flags. Another approach would be to > add a control window with checkboxes and lists to select aspects of the > demo, but I didn't really want to take that on in the context of > VPython. Your question gave me an "Aha!" moment, because if I wire the > VPython demo up to XML-RPC (or any other RPC-like mechanism), then I can > drive the demo from Tkinter, or a web page, or command-line access to > the running program. So I'm going to try that. > > I haven't had a running VPython for some time, since my hard drive > crashed a few months ago and I've been reluctant to install Fink and all > the other cruft needed to get VPython running on OS X under X Windows. > But I'll spend some time today to get it running, polish up the demo > (the code needs a bit of TLC), and wire up some remote features. I > should have something to show by the end of the week. > > Does that sound anything like what you're looking for? Sounds delicious! Art From mcfletch@rogers.com Tue Apr 29 04:45:53 2003 From: mcfletch@rogers.com (Mike C. Fletcher) Date: Mon, 28 Apr 2003 23:45:53 -0400 Subject: [Edu-sig] re: 3d in Python In-Reply-To: <3EADE64C.7010303@optonline.com> References: <70A5D146-7993-11D7-9AC3-0003939B59E8@blastradius.com> <3EADE64C.7010303@optonline.com> Message-ID: <3EADF571.2010802@rogers.com> Arthur wrote: > Dethe writes - ... > Are you on the vpython-users list? Things are pretty much in a > kicking around ideas stage. And you're sugestions - a pure C > extension, "plays better" with PyOpenGL - seem consistent with ideas > that David Scherer has put out there. Though it doesn't seem David is > in a position to devote energies to implementation work. And as a > practical matter, those who are, seem to be more C++ than C folks. > Though that issue has not been addressed head-on as far as I am aware. I'm somewhat surprised by this ("playing better") assumption. OpenGL itself should, in general, operate properly without any significant problems based on whether a C++ or C extension is calling it (basically if you can get the extension to load in Python you should be fine). PyOpenGL is programmed in C, of course, but unless you're actually trying to integrate into PyOpenGL itself (why?), or you're using, for instance C++ arrays/vectors or similar data structures instead of Numpy arrays (and passing them to PyOpenGL), it doesn't seem like it would be a problem (the OpenGL layer doesn't care how it's called, and the Python layer doesn't really care either). Is there some history of C++ extensions causing problems with PyOpenGL? >> Yes, and I'd expect the same behaviour from VPython, whether it was >> part of PyOpenGL or not. I'd like to see it become part of PyOpenGL >> in part because that is the closest thing to a standard for 3D in >> Python, and gets ported to more platforms (although their support for >> OS X has been lagging, it's still better than VPython's). VPython >> could use GLUT for its windows by default, eliminating a lot of code >> overhead in the current version, but allow windows to be specified as >> wxWindows, Tkinter, or whatever by overriding the default. > Didn't know we were lagging, have been hearing a deafening silence from the Mac peoples regarding whether the current CVS version builds & runs without problems *I* don't have one of those nice titanium powerbooks on which to test it ;) . > Again, please jump in on the list. There is more flexiblity in > thinking there than had been. Though, prelimininarily, I would > probably be on the side of "plays better" with PyOpenGL, rather than > "become part of PyOpenGL". And that is probably a more realistic > shorter term goal. Don't know where the flexibility is (can't be PyOpenGL, I've been there for 5? years (eek!) or so, and you know how pig-headed I am ;) ). I am certainly open to changes required to support compatibility, but to be quite frank, there is too much stuff in the PyOpenGL project as it is (really if OpenGLContext were not the only significant source of tests I have (and my own project so I can add to it) it would probably be broken out, (and GLE is already suffering from bit-rot due to lack of general interest AFAICS)). PyOpenGL has the equivalent of .2 total active developers/administrators (my own time shared across numbers of projects, plus a little bit of Rene's time when he's able (though he did a considerable swack when he first came on board, he seems to have been hijacked by some project or another)). Unless that situation changes (and it looks like I have a stable lead developer), I just don't have the resources to integrate and support another project. Of course, suitors with trunks full of developers are more warmly received ;) :) . That said, marketing is more subtle thing than merely living in the same project space on SourceForge. There's no reason the PyOpenGL web site can't be pointing to other 3D Python projects, particularly those which "play well" with us ;) . BTW, I'm considering doing a "3D Sumo" distribution for OpenGLContext (w/ mxTextTools + SimpleParse + Numpy + PyOpenGL + PIL + (OpenGL + GLUT&GLE)), this would be a piece-wise installer exe for windows, and a mega-RPM-set for Linux. Still not sure how necessary it is, so still considering. > Is the fact that PyOpenGL Swig, and VPython CXX, moving, it looks > like, to Boost, an impediment to even a "plays better" status? See my note above regarding playing better. I have not examined VPython's architecture (yes, I know, bad Mikey), but the Python and OpenGL levels are fairly generic in PyOpenGL, they use regular pointers to Numeric arrays for most things which are not already built-in Python types. There might be some problems with, for instance callback formats, but the PyOpenGL stuff just takes callable python objects, so as long as the python level is used from VPython I would think it would be fine unless shown otherwise :) . >> Actually, just making the default windows use GLUT instead of native >> windows would make my life better (without becoming part of PyOpenGL) >> because then I could compile and run VPython on OS X. > > > There are a number of distribution semi-nightmares arising out of the > different windowing dependecies under Windows and under Linux. On the > other hand GLUT doesn't seem to be part of the core Linux distros, nor > part of Windows - so its does present something of a distribution > problem. I know Bruce Sherwood is trying to keep the distribution as > simple as possible, but fighting something of an uphill battle in any > case due to shifting sands. And since there doesn't, at the moment > seem to be any really good and easy solution, maybe the GLUT solution > is the lesser of "evils". And when one is talking aobut education and > about graphics, it does seem unwise to short shrift Mac. So, yes, it > seems to me like it should be brought up. I can do it, but you can do > it with more authority. > > In fact maybe the simplest way to bring it up is to copy vython-users > on this exchange. > > What do you think? This may be an inappropriate suggestion, facing the same basic problems as the GLUT one, but the PyGame folks do a fairly good job of providing an OpenGL context (not to mention lots of other facilities). They also give you complete control over the mainloop. One downside, of course, is that they have no "WIMP" interface support, so your students have to write the entire interface code instead of being able to dump GTK/Tkinter/wxPython buttons onto a window to control their applications. Not sure if the PyUI project ever got far enough to be useful that way. The upside is that students are often more excited to work in a "game"-oriented environment, and there are already Python educational initiatives using PyGame (Pygsear, if I recall correctly). Okay, enough of my blathering. Enjoy all, Mike _______________________________________ Mike C. Fletcher Designer, VR Plumber, Coder http://members.rogers.com/mcfletch/ From mcfletch@rogers.com Tue Apr 29 05:10:28 2003 From: mcfletch@rogers.com (Mike C. Fletcher) Date: Tue, 29 Apr 2003 00:10:28 -0400 Subject: [Edu-sig] re: 3d in Python In-Reply-To: References: Message-ID: <3EADFB34.50008@rogers.com> Dethe Elza wrote: > Arthur wrote: > ... >> Most of the other tools you refer to, I am familiar with. >> It was actually through PyOpenGL that I became aware of and involved >> with using Python. >> My interest was in learning to work with the OpenGL API without >> wading through all kinds >> of windowing APIs to get there. The insanity one needs to go through >> to get a Windows >> window prepared for an OpenGL dot, is almost funny. Anti-intuitive >> is an understatment. > > > Yes. Somewhat easier if you use GLUT (a cross-platform windowing > toolkit for OpenGL), but still pretty hairy. I mentioned > OpenGLContext because it is supposed to be a friendlier environment. > It features windowing using wxWindows, GLUT, Tkinter, etc., for one > thing, and I believe it is object-oriented, for another. But I > haven't really explored it much. It is (some might say pathologically) object-oriented (it includes, for instance, a property-based modeling of VRML97 scenegraphs, which were in turn model on Open Inventor). It does try to be a somewhat friendlier environment *for OpenGL*, though it needs considerably more documentation to actually fulfill that goal. It is, IMO, certainly easier than raw OpenGL for many common tasks that a student wants to learn to do with OpenGL. It's not, however, trying to create "3-D graphics for everyone". It's raison d'etre (sorry to the Francophones, don't feel like finding accents at the moment) is to provide OpenGL sample code, and to make it possible to write fairly readily understood "lesson modules" for teaching OpenGL. The system takes care of the "normal" OpenGL bookkeeping, letting you (hopefully) focus on teaching the actual technique in which you are interested. For simple techniques (the kind of things you are likely to see in an introduction to computer graphics programming course, I would imagine, textures, transparency, NURBs, those kinds of things), it works quite nicely IMO. When you get into more complex techniques (for example infinite perspective matrices + shadow volumes or the like), it likely becomes a wash for educational purposes. You can point at the package or module that implements the difference from the "normal" rendering procedure, but that presupposes that the user understands that rendering procedure (there is documentation, but it is written informally, and is likely to lose a student in its current form). Enjoy, Mike _______________________________________ Mike C. Fletcher Designer, VR Plumber, Coder http://members.rogers.com/mcfletch/ From rmangaliag@slu.edu.ph Tue Apr 29 06:37:20 2003 From: rmangaliag@slu.edu.ph (ali) Date: Tue, 29 Apr 2003 13:37:20 +0800 Subject: [Edu-sig] a question on java attributes vs. python Message-ID: <200304290549.h3T5nT78008700@mbox.slu.edu.ph> is there a python counterpart for the declaration of class attributes in java like static, private, protected??? From leif@ambient.2y.net Tue Apr 29 08:35:07 2003 From: leif@ambient.2y.net (Leif Johnson) Date: Tue, 29 Apr 2003 03:35:07 -0400 Subject: [Edu-sig] a question on java attributes vs. python In-Reply-To: <200304290549.h3T5nT78008700@mbox.slu.edu.ph> References: <200304290549.h3T5nT78008700@mbox.slu.edu.ph> Message-ID: <20030429073507.GA26918@fridge> On Tue, 29 Apr 2003, ali wrote: > is there a python counterpart for the declaration of class attributes in > java like static, private, protected??? AFAIK there's no protected attribute. however, here's a class definition with a static and a private variable : class MyObject: ## this is shared among all class instances (static). it's accessed ## using self.instances instances = 0 def __init__(self, attr): self.instances += 1 ## this is a private variable because it starts with '__'. within ## this class instance it's accessed using self.__myvar, but the ## interpreter does some name mangling so external objects can't ## have direct access, for example : ## ## >>> obj = MyObject('a') ## >>> print obj.__myvar # (error) self.__myvar = attr def get_myvar(self): return self.__myvar def set_myvar(self, val): self.__myvar = val def instance_info(self): print self.instances, 'instances of MyObject have been created' As I learn more Python I'm increasingly pleased with it. In this case, you can think of all function definitions in a class as being static, just like the static 'instances' variable above ; the function and data symbols are simply shared among MyObject instances (although this is a bit more complex with inheritance involved ; that's why class functions require the 'self' parameter first, from what I understand it's how the static function code is tied to a real class instance when called). I think this is another good example of how Python and Scheme are really not so different---functions are data are functions. leif -- Leif Morgan Johnson . http://ambient.2y.net/leif/ IAESTE trainee . http://www.iaeste.org/ Salomon Automation . http://www.salomon.at/ From tjd@sfu.ca Tue Apr 29 10:14:30 2003 From: tjd@sfu.ca (Toby Donaldson) Date: Tue, 29 Apr 2003 02:14:30 -0700 Subject: [Edu-sig] Re: re: Python as a first-year programming language (Terry Hancock) In-Reply-To: <20030429034703.10513.33387.Mailman@mail.python.org> Message-ID: On Monday 28 April 2003 09:29 am, Kirby Urner wrote: > > On Monday 28 April 2003 01:37 am, Toby Donaldson wrote: > > Is there any way in Python to implement > non-deterministic > > > programming, e.g. for backtacking? It would be nice to > be able to write > > > something like this: > > > > > > def triple(a, b, c, n): > > > a = choice(n) # choice non-deterministically > chooses a number from 0 > > > to n-1 > > > b = choice(n) > > > c = choice(n) > > > if a**2 + b**2 == c**2: > > > return a, b, c > > > > You're asking if Python can do pseudo-random numbers? > > Assuming that you *did* mean this, Toby, you should be aware > that your function can be written almost exactly as you > just did: > > from random import choice > > def triple(n): > a = choice(range(n)) > b = choice(range(n)) > c = choice(range(n)) > if a**2 + b**2 == c**2: > return a, b, c > > Try it. ;-) > >>> triple(3) > >>> triple(3) > (2, 0, 2) > >>> triple(3) > (1, 0, 1) > >>> triple(3) > >>> triple(3) > (0, 0, 0) Actually, I mean non-deterministic in the sense of backtracking, as in Prolog. For instance, it would be nice if I could write this def triple(n): # doh: had extraneous parameters in the original version a = choice(n) # non-deterministically chooses a number from 0 to n-1 b = choice(n) c = choice(n) if a**2 + b**2 == c**2: return a, b, c and use it like this: >>> fn = triple(4) >>> fn.next() (0, 0, 0) >>> fn.next() (0, 1, 1) >>> fn.next() (0, 2, 2) ... etc. ... The pseudocode in Norvig & Russel's AI book (1st edition, at least) uses "choice" to make certain algorithms must shorter looking. Scheme lets you implement this in about a dozen lines of code. It comes for free in Prolog. This is one reason why Scheme and Prolog are so wicked cool. :-) See http://mitpress.mit.edu/sicp/full-text/book/book-Z-H-28.html#%_sec_4.3 for more details ... Actually, Python's list comprehensions and generators, can get you close in some cases. The above triple function can actually be implemented like this: def triple(n): """ Generates all Pythagorean triples a, b, c such that: - a^2 + b^2 = c^2 - a in range(n), b in range(n), c in range(n) """ for a in xrange(n): for b in xrange(n): for c in xrange(n): if a ** 2 + b ** 2 == c ** 2: yield a, b, c Toby From tjd@sfu.ca Tue Apr 29 10:57:57 2003 From: tjd@sfu.ca (Toby Donaldson) Date: Tue, 29 Apr 2003 02:57:57 -0700 Subject: [Edu-sig] re: Python as a first-year programming language In-Reply-To: <20030429034703.10513.33387.Mailman@mail.python.org> Message-ID: Kirby, I agree with pretty much everything you say. It would help a lot if Zope Labs or ActiveState dropped a few million dollars each into a Python marketing campaign. Maybe we could take up a collection. :-) By the way, for a totally unrelated reason, I happened across your "Getting Serious about Series" page (http://www.inetarena.com/~pdx4d/ocn/numeracy0.html) when I was playing with sums of triangular numbers. Very nice! Toby From urnerk@qwest.net Tue Apr 29 15:34:08 2003 From: urnerk@qwest.net (Kirby Urner) Date: Tue, 29 Apr 2003 07:34:08 -0700 Subject: [Edu-sig] a question on java attributes vs. python In-Reply-To: <20030429073507.GA26918@fridge> References: <200304290549.h3T5nT78008700@mbox.slu.edu.ph> <200304290549.h3T5nT78008700@mbox.slu.edu.ph> Message-ID: <5.2.0.9.0.20030429063822.01dee1f8@pop.ptld.qwest.net> At 03:35 AM 4/29/2003 -0400, Leif Johnson wrote: >On Tue, 29 Apr 2003, ali wrote: > > > is there a python counterpart for the declaration of class attributes in > > java like static, private, protected??? > >AFAIK there's no protected attribute. however, here's a class definition >with a static and a private variable : > >class MyObject: > ## this is shared among all class instances (static). it's accessed > ## using self.instances > > instances = 0 > > def __init__(self, attr): > self.instances += 1 > > ## this is a private variable because it starts with '__'. within > ## this class instance it's accessed using self.__myvar, but the > ## interpreter does some name mangling so external objects can't > ## have direct access, for example : > ## > ## >>> obj = MyObject('a') > ## >>> print obj.__myvar # (error) > > self.__myvar = attr > > def get_myvar(self): return self.__myvar > def set_myvar(self, val): self.__myvar = val > > def instance_info(self): > print self.instances, 'instances of MyObject have been created' > >As I learn more Python I'm increasingly pleased with it. In this case, you >can think of all function definitions in a class as being static, just like >the static 'instances' variable above ; the function and data symbols are >simply shared among MyObject instances (although this is a bit more complex >with inheritance involved ; that's why class functions require the 'self' >parameter first, from what I understand it's how the static function code >is tied to a real class instance when called). Your static instances variable is being overridden by your instantiated version of instances when you write self.instances += 1. Every new object will see instances = 0 at the class level, then add 1 to it, referring to its own self's dictionary. If you want "group access" to class-level instances for all objects of type MyObject, then your increment statement should read: MyObject.instances += 1. Also, what static classes allow in Java are class methods which do not require any instances at all in order to be used. This is relatively new an Python and is accomplished with the staticmethod() builtin: class Foo: instances = 0 def add(a,b): return a+b add = staticmethod(add) def __init__(self): Foo.instances += 1 >>> Foo.add(6,7) 13 >>> Foo.instances 0 Note how Foo's add method got used yet no instances of Foo were created. However, instances would also be able to use add as well. Your observation that all instances share the same method code (belonging to the class) is a feature of OO in general, i.e. it's true of Java methods whether or not they're static. It's not like every instance duplicates all the method code in its own patch of memory. However, having an instance does mean you might bind a method to just the one instance, such that the other objects of the same type wouldn't have it: >>> obj = Foo() >>> def newadd(a,b): return "%s %s" % (a,b) >>> obj.add = newadd # replace instance method with new version >>> obj.add(5,6) >>> '5 6' >>> obj2 = Foo() # unaffected by the fact that obj has own version >>> obj2.add(1,2) 3 Such an instance-specific method *would* have its own patch of memory. You can rebind a static method as well, in which case the behavior of the instances will be changed (unless they already have their own versions): >>> def newadd2(a,b): return "%s%s" % (a,b) # taking out space >>> Foo.add = staticmethod(newadd2) # replace static method >>> obj.add(1,2) # obj already had its own version '1 2' >>> obj2.add(1,2) # but obj2 now invokes the class version '12' To add to the mix, there's yet another builtin called classmethod which has no exact equivalent in Java. It binds the class (vs. an instance) to an implicit first variable, just as ordinary class methods bind the specific instance to self. Below, we see two classes derived from Foo, both using Foo's classmethod to update their respective *class variables* (instances), i.e. we update the two class variables independently, using a common class method. >>> class Foo: def addinstance(cls): cls.instances += 1 print cls.instances addinstance = classmethod(addinstance) >>> class Spam(Foo): instances = 0 def __init__(self): self.addinstance() >>> class Bar(Foo): instances = 0 def __init__(self): self.addinstance() >>> obj1 = Spam() 1 >>> obj2 = Spam() 2 >>> obj3 = Bar() 1 >>> >I think this is another good example of how Python and Scheme are really >not so different---functions are data are functions. I've yet to comprehend OO in Scheme. It seems to be an "advanced topic" in that language, whereas in Python "everything is an object" so it makes sense to start thinking in OO terms fairly early. Kirby >leif > >-- >Leif Morgan Johnson . http://ambient.2y.net/leif/ >IAESTE trainee . http://www.iaeste.org/ >Salomon Automation . http://www.salomon.at/ > >_______________________________________________ >Edu-sig mailing list >Edu-sig@python.org >http://mail.python.org/mailman/listinfo/edu-sig From ajsiegel@optonline.net Tue Apr 29 15:47:58 2003 From: ajsiegel@optonline.net (Arthur) Date: Tue, 29 Apr 2003 10:47:58 -0400 Subject: [Edu-sig] re: Notes from "Daddy, Are We There Yet?" Message-ID: <3EAE909E.5090609@optonline.com> >Notes from "Daddy, Are We There Yet?" >Alan Kay's talk at O'Reilly Emerging Technology Conference 2003 >Cory Doctorow >http://craphound.com/kayetcon2003 Wonderfully interesting exchange. Especially the "exchange" part. Jason's back. Art From ajsiegel@optonline.net Tue Apr 29 22:30:57 2003 From: ajsiegel@optonline.net (Arthur) Date: Tue, 29 Apr 2003 17:30:57 -0400 Subject: [Edu-sig] re: Notes from "Daddy, Are We There Yet?" Message-ID: <3EAEEF11.9070908@optonline.com> I had written - >Wonderfully interesting exchange. Especially the "exchange" part. And which led me to this essay by Edsger W.Dijkstra, 18 June 1975 "How do we tell truths that might hurt" http://www.cs.virginia.edu/~evans/cs655/readings/ewd498.html I like the tone, more than I probably should. To those who have studied CS in some formal way Dijkstra might be old hat. The fun for me is that so much of this old hat stuff is new ground. It does stike me that in all the discussion here about mathematics and programming, mathematics vs programming, programming with and without mathematics - there has never been a reference to the insistence of someone like Dijkstra that programming is plain and simple a branch of applied mathematics - in fact the most difficult one. "The easiest machine applications are the technical/scientific comnputations". Which rings true. If I am understanding the point, anyway. PyGeo is in a sense a program to do technical/scientific computations (and draw them). It makes sense that as a beginner, I tackled what was easiest. Again, if I am understanding the point correctly, it lends support to a notion of starting with programming and computational mathematics. Because it is the easiest, and that, under common sense ideas, is normally where one starts. Art From jeff@elkner.net Wed Apr 30 04:35:34 2003 From: jeff@elkner.net (Jeffrey Elkner) Date: 29 Apr 2003 23:35:34 -0400 Subject: [Edu-sig] looking for help with Jython... Message-ID: <1051673734.4450.31.camel@robeson> I'm in the middle of learning some Java to get ready for next year's AP CSC course. I would like to make good use of the Python my students already know, and I was thinking that Jython might offer some interesting educational opportunities. What I would most like to be able to do is to import Java classes into Python in order to be able to "play around" with them in the interpreter. So far, I have not been able to make this work. I'm starting with a simple example from our book: class Vehicle { public int passengers; public int fuelcap; public int mpg; public Vehicle(int p, int f, int m) { passengers = p; fuelcap = f; mpg = m; } public int range() { return mpg * fuelcap; } public double fuelneeded(int miles) { return (double) miles / mpg; } } (Actually, I added all the "public"s because otherwise Jython couldn't see them when I did: import Vehicle How can I create a Vehicle object inside of Jython? Thanks! -- Jeffrey Elkner Open Book Project From liao@holycow.sandiego.edu Wed Apr 30 05:52:15 2003 From: liao@holycow.sandiego.edu (luby liao) Date: Tue, 29 Apr 2003 21:52:15 -0700 Subject: [Edu-sig] looking for help with Jython... Message-ID: <200304300452.h3U4qFGW008550@holycow.sandiego.edu> Jeffrey, try this: 1. change first line to public class Vehicle { 2. shell> javac Vehicle.java 3. shell> jython [liao@zen tmp]$ jython Jython 2.1 on java1.3.1 (JIT: null) Type "copyright", "credits" or "license" for more information. >>> import Vehicle >>> v = Vehicle(3,5,6) >>> v Vehicle@3f1179 >>> cheers, Luby > I'm in the middle of learning some Java to get ready for next year's AP > CSC course. I would like to make good use of the Python my students > already know, and I was thinking that Jython might offer some > interesting educational opportunities. > > What I would most like to be able to do is to import Java classes into > Python in order to be able to "play around" with them in the > interpreter. So far, I have not been able to make this work. I'm > starting with a simple example from our book: > > > class Vehicle { > public int passengers; > public int fuelcap; > public int mpg; > > public Vehicle(int p, int f, int m) { > passengers = p; > fuelcap = f; > mpg = m; > } > > public int range() { > return mpg * fuelcap; > } > > public double fuelneeded(int miles) { > return (double) miles / mpg; > } > } > > (Actually, I added all the "public"s because otherwise Jython couldn't > see them when I did: > > import Vehicle > > How can I create a Vehicle object inside of Jython? > > Thanks! > From villate@gnu.org Wed Apr 30 08:41:38 2003 From: villate@gnu.org (Jaime E. Villate) Date: Wed, 30 Apr 2003 08:41:38 +0100 Subject: [Edu-sig] re: Notes from "Daddy, Are We There Yet?" In-Reply-To: <3EAE909E.5090609@optonline.com>; from ajsiegel@optonline.net on Tue, Apr 29, 2003 at 10:47:58AM -0400 References: <3EAE909E.5090609@optonline.com> Message-ID: <20030430084138.D396@fe.up.pt> On Tue, Apr 29, 2003 at 10:47:58AM -0400, Arthur wrote: > >Notes from "Daddy, Are We There Yet?" > >Alan Kay's talk at O'Reilly Emerging Technology Conference 2003 > >Cory Doctorow > > >http://craphound.com/kayetcon2003 > > Wonderfully interesting exchange. Especially the "exchange" part. Squeak looks very interesting but it is a pity that the Apple license it uses is not a real Free Software license. I'll stick to python that is real Free Software. Jaime From leif@ambient.2y.net Wed Apr 30 08:55:02 2003 From: leif@ambient.2y.net (Leif Johnson) Date: Wed, 30 Apr 2003 03:55:02 -0400 Subject: [Edu-sig] a question on java attributes vs. python In-Reply-To: <5.2.0.9.0.20030429063822.01dee1f8@pop.ptld.qwest.net> References: <200304290549.h3T5nT78008700@mbox.slu.edu.ph> <200304290549.h3T5nT78008700@mbox.slu.edu.ph> <5.2.0.9.0.20030429063822.01dee1f8@pop.ptld.qwest.net> Message-ID: <20030430075502.GB7156@fridge> On Tue, 29 Apr 2003, Kirby Urner wrote: > Your static instances variable is being overridden by your instantiated > version of instances when you write self.instances += 1. Every new object > will see instances = 0 at the class level, then add 1 to it, referring > to its own self's dictionary. > > If you want "group access" to class-level instances for all objects of > type MyObject, then your increment statement should read: > MyObject.instances += 1. Oops ! Thanks for the correction. : ) Wrote too quickly, yet again. I wasn't aware of the staticmethod() function either, but that's excellent. > I've yet to comprehend OO in Scheme. It seems to be an "advanced topic" in > that language, whereas in Python "everything is an object" so it makes sense > to start thinking in OO terms fairly early. Even if you don't consciously start out thinking in OO terms, even, I've found that it's easy to nudge myself in the OO direction as needed. I'm especially a fan of being able to use functions like objects (and vice versa). The apply() function is great. Python has made the procedural -> OO transition much easier than, e.g. C would have made it. leif -- Leif Morgan Johnson . http://ambient.2y.net/leif/ IAESTE trainee . http://www.iaeste.org/ Salomon Automation . http://www.salomon.at/ From ajsiegel@optonline.net Wed Apr 30 12:09:49 2003 From: ajsiegel@optonline.net (Arthur) Date: Wed, 30 Apr 2003 07:09:49 -0400 Subject: [Edu-sig] re: Notes from "Daddy, Are We There Yet?" Message-ID: <3EAFAEFD.8040800@optonline.com> >Squeak looks very interesting but it is a pity that the Apple license >it uses is not a real Free Software license. I'll stick to python that >is real Free Software. But I did call off my boys since Kay left Disney. That is I no longer hyperventilate at the mention of Squeak. I wish Kay was indiscrete enough to speak about his tenure there. Art From jeff@elkner.net Wed Apr 30 12:51:46 2003 From: jeff@elkner.net (Jeffrey Elkner) Date: 30 Apr 2003 07:51:46 -0400 Subject: [Edu-sig] looking for help with Jython... In-Reply-To: <200304300452.h3U4qFGW008550@holycow.sandiego.edu> References: <200304300452.h3U4qFGW008550@holycow.sandiego.edu> Message-ID: <1051703506.17348.9.camel@mdeicaza> Thanks, Luby, this worked like a charm! It is also *way too cool* ;-) This is what I had hoped to be able to do, and it worked just liked I had hoped it would. We have a real opportunity here to promote Python next year. I will be working closely with my colleagues from the other schools in our system next year to develop the new Java course. It will be a great chance to promote the use of Python in our first year courses. Jython and the ability to interact with Java classes like this adds tremendously to the already strong case for using Python. Thanks again! jeff On Wed, 2003-04-30 at 00:52, luby liao wrote: > Jeffrey, try this: > > 1. change first line to > > public class Vehicle { > > 2. shell> javac Vehicle.java > > 3. shell> jython > > [liao@zen tmp]$ jython > Jython 2.1 on java1.3.1 (JIT: null) > Type "copyright", "credits" or "license" for more information. > >>> import Vehicle > >>> v = Vehicle(3,5,6) > >>> v > Vehicle@3f1179 > >>> > > cheers, Luby > > > > > I'm in the middle of learning some Java to get ready for next year's > AP > > CSC course. I would like to make good use of the Python my students > > already know, and I was thinking that Jython might offer some > > interesting educational opportunities. > > > > What I would most like to be able to do is to import Java classes > into > > Python in order to be able to "play around" with them in the > > interpreter. So far, I have not been able to make this work. I'm > > starting with a simple example from our book: > > > > > > class Vehicle { > > public int passengers; > > public int fuelcap; > > public int mpg; > > > > > public Vehicle(int p, int f, int m) { > > passengers = p; > > fuelcap = f; > > mpg = m; > > } > > > > > public int range() { > > return mpg * fuelcap; > > } > > > > > public double fuelneeded(int miles) { > > return (double) miles / mpg; > > } > > } > > > > (Actually, I added all the "public"s because otherwise Jython > couldn't > > see them when I did: > > > > import Vehicle > > > > How can I create a Vehicle object inside of Jython? > > > > Thanks! > > > > > _______________________________________________ > Edu-sig mailing list > Edu-sig@python.org > http://mail.python.org/mailman/listinfo/edu-sig -- Jeffrey Elkner