Archive for July 3, 2012

Typography to describe iteration

One of the complaints about Python is the use of indentation to define blocks.  A quote from Don Knuth is often used to defend that use:

We will perhaps eventually be writing only small modules which are identified by name as they are used to build larger ones, so that devices like indentation, rather than delimiters, might become feasible for expressing local structure in the source language.

Is it natural to use typography to indicate local structure?  Is it more accessible than curly brace ({}) notation, or BEGIN/END blocks?  Do we understand it easily?

I thought about this Sunday morning when I was at services, using a songbook I’d never seen before. The verses and refrain were indicated like this:

You sing the refrain (the “How great thou art” part) twice, indicated by “(2)” — which is pretty obvious, since it’s clear you wouldn’t sing “(2).”  What’s the “scope” of the repeat?  Well, the refrain is italicized, and so is the “(2).”  So you sing twice the part in italics.

I thought it was interesting to use typography to convey to the general population how to “iterate.” If we could count on the general population to know musical notation, and if the music was provided, there’s a different notation for indicating “iteration.”  The use of typography for defining iteration is meant to be more understandable, more generally accessible.

July 3, 2012 at 4:32 am 9 comments

Enter your email address to follow this blog and receive notifications of new posts by email.

Join 10,186 other subscribers


Recent Posts

Blog Stats

  • 2,060,874 hits
July 2012

CS Teaching Tips