Wednesday, April 13, 2011

python - roots in teaching, now in enterprise

How suitable is Python for teaching folks who have no programming experience?

It is just this situation that prompted Guido Van Rossum to create Python.

Without wishing to paraphrase (see links at the end and form your own comments), I draw out my own three points:

  1. Readability counts.
  2. The language might want to have seem a little familiar in style to Mathematical constructs / thinking.
  3. Resist the temptation to add new constructs all the time, and brevity is not everything (see 1)

Such ideas might predate Ruby, and some other languages which make more use of keyboard symbols.

I like Ruby and I have programmed in Ruby.
However choosing Ruby as my main language, might well mean me choosing less of (1) and (3) above.

I am not learning my first language, but those who are, might benefit from having to pick up fewer symbols.
[ They may already be full of symbols having just left a Mathematics class :) ]

How suitable is Python for learning - access from any Computer?

Here I have shown a short while loop example, that is run online.
( Interactive web page at: )

Python is easily to install on any computer.
(If the school admin can install a browser, then they could certainly visit and click once the download is complete. )

Having seen an example of Python code above, this might be a good opportunity to show a slide from Guido himself (2006):

Now look again at the code in the Fizz Buzz example above and ask:
  • Does it seen natural? Is there some feel similar to how we might express the recipe in natural language?
  • Does it require the use of plenty of symbols / constructs which a school age child would need to learn new?
I think it stands up fairly well.
(Explaining that elif is an abbreviation for 'else if' is one thing I see as new learning.)

count = 1
while (count <= 100):
  if (count % 3 + count % 5 == 0):
    print "fizz-buzz"
  elif (count % 3 == 0):
    print "fizz"
  elif (count % 5 == 0):
    print "buzz"
    print count
  count += 1

A Simple IDE for Python - no install required:

Look again at the image above for the fizz buzz example, you might spot the highlighting. That online page at, does simple stepping, that a learner can follow.

What is not visible in my crop, is the box which shows the internal value of the variables as things progress. Seems a good teaching aid, and no install required.

Visit the page yourself and paste in my code above, or some variant, and step it through using the buttons. Works well :)

Pythonic programming and fizz buzz:

The intention in this article is to act as an introduction, and provide a very simple example.

How much rigour about Python style, you put into your teaching is up to you.

( It is not my intention here, to aim to be 'Pythonic', or provide a perfect coding example. If you want that, then there is a link at the end of this article. )

Python as part of college "Introduction to Programming":

Teaching College students programming is a little different from teaching school age.

Philip J Guo makes some good points in this article, about why Python may be the right choice for College.

Notes and Further Reading:

The final few links given below are provided as a further consideration, some might argue a minor consideration. Programming languages that involve more [ non-natural ] constructs, will perhaps present greater challenges, to people who have some difficulty absorbing new symbols and associating those symbols meaningfully.

No comments: