Re: [Edu-sig] Accessibility to non CS types?

2006-05-28 Thread Andre Roberge
On 5/26/06, kirby urner [EMAIL PROTECTED] wrote:
 So you're saying Python is sufficiently accessible because we may still assume scientists and engineers are learning C++ and Java? The fact remains:many academics are throwing up their hands when encountering Python, because they can't make the leap from what they
 knew before. If I may, I'd like to start with a brief personal history to introduce what I see as two barriers to learning Python for scientists/academics.I learned FORTRAN in 1977 in a College-level course (pre-University in Quebec). I then went to University to study Physics. During my undergraduate degree, I wrote perhaps 3 (short) computer programs. Still, FORTRAN was easily understood as the stuff I did was mostly numerical work. *The concepts and language I had learned in Physics were easily adaptable in FORTRAN.*
While in graduate school, I bought a PC and learned some basic C programming, mostly for fun. Again, I didn't write many programs, and they weren't very long. It did prepare me for what was to come. *The transition from FORTRAN and C was fairly easy, as I could write FORTRAN-style programs in C ;-).
As a Physics prof, I wanted to introduce visual tools to my students. After learning about Java Applets, I decided that they were an ideal tool. So, I set up to learn enough Java to write my own applets for physics demo. I wrote a grand total of perhaps 10 applets over the course of 3 years, in between teaching and doing research. This was around 1995.
The first barrier I encountered was the dot notation. Nowhere did I see it explain separately, as a notational convention, shared by many languages. I thought it was something weird about Java that I would have to learn. 
Solution: introduce the dot notation totally separately from the other programming syntax. This is something I tried to do in one rur-ple lesson.The second barrier I found was the insistance on categorizing relationships in terms of is-a and has-a. The examples that I would find most natural to look at were often counterintuitive. I remember in particular seeing that programming examples that use the relationships between a circle and an ellipse (or a rectangle and a square) seemed to have the relationship going backwards.
Let me give a concrete example explaining inheritance for non-computer scientists.===class Father(object): def __init__(self): self.eye_colour = blue def greets(self):
 print Hello there!  class Mother(object): def __init__(self): self.eye_colour = brownclass Child(Mother, Father): passSally = Child()
print Sally.eye_colourSally.greets()===The computer scientists in the (virtual) room are probably horrified. A Child is not a Mother, nor a Father and you do not have the proper is-a relationship. Yet, I would claim that the above example would be very appropriate for the average person. Sally inherit brown eyes for her mother, not because brown is the dominant gene (as in biology) in this case, but because of the inheritance order. (Interchange Mother and Father in the class Child and Sally will have blue eyes)
Words like inheritance have been borrowed and adapted by computer scientists for use in their own discipline. They have been borrowed because they were familiar words that conveyed (partly) the concept used in the scientific discipline. They have been adapted because the usual definition was not technically correct. I believe that teaching those concepts should go through the same process: start with the familiar (but slightly incorrect) use of the word, and refine later on.
This, btw, is how I use to teach about work in physics, so I have some idea about the possible use of this approach.. If I ask my son to carry the groceries bags from the car to the kitchen (essentially at the same horizontal level), he will not believe me if I tell him that he did no work. Yet, he would have done no work (W=0) [against gravity], as every physics textbook would tell you. 
==As a final point about the personal history: after not having done any programming for about 8 years (and having never written any significant computer program), I decided to learn Python as a hobby with the goal to eventually teach my kids. By then, I had some idea about the dot notation, so this barrier was easily overcome. Python tutorials that I skimmed through did not insist on the importance of is-a and has-a relationship, so I didn't feel constrained in how I set up the relationships between the classes I wrote. I was free to explore (and make mistakes!) and it was fun! It still is.
André
___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


[Edu-sig] Elementary graphics library

2006-05-28 Thread Johannes Woolard
As part of my Summer of Code proposal, I said i would write a simple
graphics library.
I've spent the last couple of hours brainstorming this, and written it all up:

http://crunchy.python-hosting.com/wiki/GraphicsDoc.

If anyone has any comments/ideas I would love to hear them!

Johannes

-- 
Johannes Woolard,
Oriel College, Oxford
OX1 4EW
07837880296
ox extn: 26611
___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


Re: [Edu-sig] Accessibility to non CS types?

2006-05-28 Thread kirby urner
On 5/28/06, Andre Roberge [EMAIL PROTECTED] wrote:

 The first barrier I encountered was the dot notation.  Nowhere did I see
 it explain separately, as a notational convention, shared by many languages.
  I thought it was something weird about Java that I would have to learn.

 Solution: introduce the dot notation totally separately from the other
 programming syntax.  This is something I tried to do in one rur-ple lesson.


I very much agree.  I even go so far as to phase dot notation into
standard mathematics, as another way to express such concepts as
mytriangle.A (returns a degree measure).  Use dot notation even
without reference to any specific computer language, but with
reference to the OO paradigm (math as extensible type system meme).

 The second barrier I found was the insistance on categorizing relationships
 in terms of is-a and has-a.  The examples that I would find most natural
 to look at were often counterintuitive.  I remember in particular seeing
 that programming examples that use the relationships between a circle and an
 ellipse (or a rectangle and a square) seemed to have the relationship going
 backwards.

 Let me give a concrete example explaining inheritance for non-computer
 scientists.
 ===
 class Father(object):
 def __init__(self):
 self.eye_colour = blue
 def greets(self):
  print Hello there!

 class Mother(object):
 def __init__(self):
 self.eye_colour = brown

 class Child(Mother, Father):
 pass

 Sally = Child()
  print Sally.eye_colour
 Sally.greets()
 ===
 The computer scientists in the (virtual) room are probably horrified.  A
 Child is not a Mother, nor a Father and you do not have the proper is-a
 relationship.  Yet, I would claim that the above example would be very
 appropriate for the average person.  Sally inherit brown eyes for her
 mother, not because brown is the dominant gene (as in biology) in this case,
 but because of the inheritance order.  (Interchange Mother and Father in the
 class Child and Sally will have blue eyes)

 Words like inheritance have been borrowed and adapted by computer
 scientists for use in their own discipline.  They have been borrowed because
 they were familiar words that conveyed (partly) the concept used in the
 scientific discipline.  They have been adapted because the usual definition
 was not technically correct.  I believe that teaching those concepts should
 go through the same process: start with the familiar (but slightly
 incorrect) use of the word, and refine later on.

Yes.  This is characteristic of many disciplines; they absorb from
ordinary language, but pretty soon stop paying their debt, i.e. stop
building on-ramps.  Instead, they close off and fortify, so that those
not in the know sound like fools to the ears of insiders.  It's a
kind of corruption really.  My buddy Ed Applewhite had 'Layman'
printed on his business card, kind of a warning that he was nobody's
fool (yet he often pretended he couldn't quite follow).

 This, btw, is how I use to teach about work in physics, so I have some
 idea about the possible use of this approach..  If I ask my son to carry the
 groceries bags from the car to the kitchen (essentially at the same
 horizontal level), he will not believe me if I tell him that he did no work.
   Yet, he would have done no work (W=0) [against gravity], as every physics
 textbook would tell you.

Yes, work is especially problematic, as it only counts if against
the vectors you consider worthy.  Irrelevant vectors, though
resistent, don't bar the way to getting the job done (at least not
directly), so you can go down fighting, working like crazy, yet the
physicist will tell you you're doing no work whatsoever (like the
burglar fumbling with the safe combo is doing no work, if the police
come too soon).

 ==
 As a final point about the personal history: after not having done any
 programming for about 8 years (and having never written any significant
 computer program), I decided to learn Python as a hobby with the goal to
 eventually teach my kids.  By then, I had some idea about the dot notation,
 so this barrier was easily overcome.  Python tutorials that I skimmed
 through did not insist on the importance of is-a and has-a relationship,
 so I didn't feel constrained in how I set up the relationships between the
 classes I wrote.  I was free to explore (and make mistakes!) and it was fun!
  It still is.

 André


Useful autobio.  I used to strongly encourage Arthur to switch into
this mode from time to time.  That's related to your earlier remarks
about academic jargons:  we're each a walking namespace (Pythonic
concept), yet sometimes forget that fact (fish unaware of water).
When you go into autobio, people get a better idea of how to factor
out various biases you may never be free of in this life (because they
define you as a person e.g. fought in 'Nam for eight years).

Your discussion of how is-a versus has-a easily confounds is quite
useful.  And I 

Re: [Edu-sig] list newbie

2006-05-28 Thread Scott David Daniels
Kris Olson wrote:
 I am new to teaching Python but have enjoyed the reaction of my students to
 Python.  I have been using the interactive mode to demonstrate it is hard 
 for 
  them to see when I get down to the bottom of the page.
  Is there a way to clear the screen or open a new interactive screen?

Here's a trick I use for myself when the shell screen gets too full:

1) Make sure another window is open (do File / New Window if needed).
2) Close the shell screen.
3) On (one of) the open window(s) do Windows / Python Shell.

You now have a nice clean window.

I agree it would be nice to be able to prune the shell window
contents.  Especially if you have output some long text w/o
returns in it, scrolling can get painfully slow as the output
accumulates.

-- Scott David Daniels
[EMAIL PROTECTED]

___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


Re: [Edu-sig] Elementary graphics library

2006-05-28 Thread Paul D. Fernhout
If you haven't already, you could check out:

Pyxel
   http://bellsouthpwp.net/p/r/prochak/pyxel.html
   Pyxel is a python library that provides a dynamic, interactive, highly 
portable, graphical environment.  It makes diagrams and widgets look 
identical in whatever underlying environment it supports.

wxOGL
   http://wiki.wxpython.org/index.cgi/wxOGL
   The OGL library was originally written in C++ and provided to wxPython 
via an extension module wrapper as is most of the rest of wxPython. The 
code has now been ported to Python (with many thanks to Pierre Hjälm!) in 
order to make it be more easily maintainable and less likely to get rusty 
because nobody cares about the C++ lib any more.
   (bottom of that pages has more alternatives, like the next)

Piddle
   http://piddle.sourceforge.net/
PIDDLE is a Python module for creating two-dimensional graphics in a 
manner that is both cross-platform and cross-media; that is, it can 
support screen graphics (e.g. QuickDraw, Windows, Tk) as well as file 
output (PostScript, PDF, GIF, etc.). It makes use of the native 2D drawing 
calls of each backend, for maximum efficiency and quality. It works by 
defining a base class (piddle.Canvas) with methods for all supported 
drawing primitives. A particular drawing context is provided in the form 
of a derived class. PIDDLE applications will be able to automatically 
select an appropriate backend for the user's environment. 

and of course PyGame or PySDL or even the OpenGL Canvas stuff (there are 
probably more) for ideas and to see what others have done before in pure 
Python and you could possibly build on. Or even PyGeo if your focus is 
mainly on geometry instead of arbitrary 2D graphics (I wasn't sure).

There are a lot of charting and plotting and other graphics packages out 
there with Python bindings (including Cairo, which you are looking at as 
your first backend target). You can ask yourself if a newer API really 
gets you that much over these existing things? Will it really be that much 
simpler once you really try to make it useful? And if you have a 
crossplatform backend already like Cairo or wx, does it gain you that much 
to abstract above that if can you simplify it somehow, versus just make a 
simple interface to one cross-platform library (which may be hard enough)?

Now, it still might be worth doing for you even if the answers are no, but 
to maximize your effectiveness it is nice go in with your eyes open about 
whether you are doing this to learn and to have fun, to improve an 
existing thing, or to make something new that fills an empty niche (or to 
try do do all three); that is a question I often wrestle with for my own 
projects. :-)

--Paul Fernhout


Johannes Woolard wrote:
 As part of my Summer of Code proposal, I said i would write a simple
 graphics library.
 I've spent the last couple of hours brainstorming this, and written it all up:
 
 http://crunchy.python-hosting.com/wiki/GraphicsDoc.
 
 If anyone has any comments/ideas I would love to hear them!
 
 Johannes
 

___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


Re: [Edu-sig] list newbie

2006-05-28 Thread Steven Bird
On 5/28/06, Scott David Daniels [EMAIL PROTECTED] wrote:
 Here's a trick I use for myself when the shell screen gets too full:

 1) Make sure another window is open (do File / New Window if needed).
 2) Close the shell screen.
 3) On (one of) the open window(s) do Windows / Python Shell.

 You now have a nice clean window.

But then you lose the session.  You could recover the session by
re-entering the necessary lines (e.g. importing modules, defining
variables), but that leaves us with the original problem...

-Steven Bird
___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


Re: [Edu-sig] Accessibility to non CS types?

2006-05-28 Thread Peter Bowyer
At 22:23 26/05/2006, Ian Bicking wrote:
  Not many scientists and engineers learn C or sh any more.  ABC's
  developers had the right idea.

Yes, but they learn C++ and Java and things like that.

You wish.  As part of my project I did a brief survey of what physics 
departments used to teach programming (research that didn't make it 
into the final report due to space).  Most offered only an 
introductory course, often less than 1 lab a week for 10 weeks.  C 
was still popular (as was Fortran) but I argue that due to the lack 
of time the scientists and engineers don't learn these languages, 
they learn enough to complete the exercises to finish the 
course.  Not because they're inherantly lazy, but because there's way 
too much material to cover in the pitifully small time allocated.

I wish it were different, but despite computational work being one of 
the important methods of research in physics, programming is not seen 
as a key part of a physics degree.  And I thorougly concur with the 
comment about it being taught by the previous generation: many who 
were in charge of teaching or planning the computer modules had been 
using computers in the 1960's - which doesn't make it wrong, but 
provides a different outlook on today's systems.

Peter

___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


Re: [Edu-sig] Accessibility to non CS types?

2006-05-28 Thread Peter Bowyer
At 22:13 29/05/2006, Bill Bradley wrote:
 Good gravy?!  Where did you look?  When I got my Physics 
 degree we not only had to take programming, but we built 68K 
 breadboard computers, programmed them in assembly (with a hex 
 keypad) and used them to read and drive ADC/DACs to output on 
 'scopes.  And no that was not during the Dark Ages, I got my degree 
 in the 90s.

Round most of the physics departments in the UK, where course details 
were available to the public via their websites.  Do check back - 
does your physics department still do it, or has it fallen by the 
wayside as students arrive knowing less physics, so more 'core' 
material has to be crammed into the 3 years of a Bachelor's degree?

Peter

___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


Re: [Edu-sig] Accessibility to non CS types?

2006-05-28 Thread francois schnell
On 26/05/06, Paul D. Fernhout [EMAIL PROTECTED] wrote:
I think Self leads the way here in generality with one inspector that canbe used to build GUIs, programs, or just sets of objects. And here is anattempt to bring that ease of use to Python, building on ideas from Self
(and Squeak): :-)http://svn.sourceforge.net/viewcvs.cgi/patapata/trunk/PataPata/PataPata.py?view=logDoesn't succeed yet perhaps in making that beginner friendly, but a start.
(PythonCard is much better choice for current work though.)Hello,I've just gave a try to your PataPata  and I already have fun with it while testing it :)
http://francois.schnell.free.fr/bazar/patapata-test1/patapata-test1.htmlWill it be possible to directly add new methods to morphs (maybe from the inspector ? ... when I saw the 'grow' method I wanted a shrink' one ...). Is there a way yet to execute a Morph method from another Morph (if I click on Morph 1 I'd like to execute method X from Morph 2 for example).
I find your PataPata promising and I'm eager to see how it evolves :)francois
--Paul Fernhout___Edu-sig mailing listEdu-sig@python.orghttp://mail.python.org/mailman/listinfo/edu-sig

___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


Re: [Edu-sig] Accessibility to non CS types?

2006-05-28 Thread Scott David Daniels
Andre Roberge wrote:
 ... Let me give a concrete example explaining inheritance for non-computer
 scientists.
 ===
 class Father(object): ...
 class Mother(object): ...
 
 class Child(Mother, Father): ...
 ===
 The computer scientists in the (virtual) room are probably horrified.  

Yup.  I am aghast.  You are using the built-from relationship.  For
yourself this is fine, but pedagogically it leads to very bad habits.
The reason I am appalled is that I have maintained code that was written
this way, and the mess that results over years of extending from such
a shaky foundation is scary.

 I would claim the above example would be appropriate for the average person.

I claim this is because you are a scientist, not a mathematician.  At
Penn, Mathematics was an Art, not a Science (I have great sympathy for
that classification).  You are in the habit of lying to your students
and, next course, telling them you know, what you learned in the
previous course was wrong.  This is a reason for people leaving the
sciences.  Mathematicians tend to try to stick to truths, though they
expand the universe they talk about each time.  In part this distinction
in approaches makes sense because mathematicians who make mistakes are
corrected (and scorned) by other mathematicians, while physicists are
corrected by reality (and refine their models).

Computer Science is a funny field, reached from both mathematics and
engineering, so the ideas you see there can come from either of these
sides (and cause lovely fights in faculty meetings).  I consider CompSci
an architecture-like discipline, with mathematics holding the position
in CompSci that physics has in architecture.

 Words like inheritance have been borrowed and adapted by computer
 scientists for use in their own discipline.
While words like spin for physicists  Natural languages seldom
have precise definitions, and Computer Science is not close to the
worst offender in this respect.

To follow up on Kirby's personal history suggestion:  I was a math
loving kid by fourth grade, came to computers by accident in summer
after 9th grade (in 1966) doing machine language on a vacuum tube
computer (LGP-30).  The following summer I spent full-time in an
NSF-sponsored class at Penn where we a language a week for the summer
(two programs per language).  The experience gave me a good feel for
what a programming language is in general, as well as specifically.

I decided around 1972 (after auditing a class or two from Knuth) that
I could be either a mediocre mathematician or a very good computer
programmer.  Twenty years ago I went back to school to attempt a PhD
as a teaching union card in CompSci, and got a drop-out masters.
For my research I was trying to do Query Optimization in Object-Oriented
Databases, and glanced briefly at Python (the type system did not fit my
research needs).  After working in compilers and Databases after school,
I picked up Python as a way of pursuing a long-running personal project,
and had the most fun I've had in a new language in 30 years.

--Scott David Daniels
[EMAIL PROTECTED]

___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig


Re: [Edu-sig] Elementary graphics library

2006-05-28 Thread Dethe Elza
On 5/28/06, Paul D. Fernhout [EMAIL PROTECTED] wrote:
 If you haven't already, you could check out:

Also:

PIL.ImageDraw
http://www.esrf.fr/computing/bliss/python2/pil/PIL.ImageDraw.html
http://www.pythonware.com/library/pil/handbook/imagedraw.htm
The ImageDraw module provide simple 2D graphics for Image
objects. You can use this module to create new images, annotate or
retouch existing images, and to generate graphics on the fly for web
use.

Aggdraw
http://effbot.org/zone/draw-agg.htm
The aggdraw module implements the basic WCK 2D Drawing Interface
on top of the AGG library. This library provides high-quality drawing,
with anti-aliasing and alpha compositing, while being fully compatible
with the WCK renderer.

Matplotlib
http://matplotlib.sourceforge.net/
matplotlib is a python 2D plotting library which produces
publication quality figures in a variety of hardcopy formats and
interactive environments across platforms. matplotlib can be used in
python scripts, the python and ipython shell (ala matlab or
mathematica), web application servers, and six graphical user
interface toolkits.

Kiva
   http://code.enthought.com/kiva/
   Kiva is a multi-platform DisplayPDF drawing engine that supports
multiple output backends, including Windows, GTK, and Macintosh native
windowing systems, a variety of raster image formats, PDF, and
Postscript.

DrawBot/NodeBox (OS X only, but useful as examples of simple 2D systems)
http://drawbot.com/index.html
http://nodebox.net/manual/reference/topics.php
DrawBot is an powerful, free application for MacOSX that invites
you to write simple Python scripts to generate two-dimensional
graphics. The builtin graphics primitives support rectangles, ovals,
(bezier) paths, polygons, text objects and transparency.

PyCairo
http://cairographics.org/pycairo
Cairo is a library for drawing vector graphics. Vector graphics
are interesting because when they appear on screen, they don't lose
clarity when resized or transformed.

--Dethe
___
Edu-sig mailing list
Edu-sig@python.org
http://mail.python.org/mailman/listinfo/edu-sig