[Tutor] How to teach Python

Danny Yoo dyoo at hkn.eecs.berkeley.edu
Sun Aug 13 06:59:33 CEST 2006

>> 2) Since this is an introductory class, I am tempted to leave out 
>> "optional" topics like argument matching modes, walk, map, filter, 
>> reduce, apply. Do you think these are required for any Python 
>> programmer?
> Since many of there will disappear in Python 3 it might be OK to omit 
> them. OTOH for those of us who come from languages like APL, these 
> constructs are dear to our hearts.

Hi Elaine,

More generally: the "function is as first-class value" is a fundamental 
concept.  I'm not sure when that concept should be introduced, but it 
definitely belongs in an introductory programming course.  If one looks 
at code like this:

     if input == 'a': doA()
     elif input == 'b': doB()

if we know that functions are avlues, we can reconsider it as:

     dispatchTable = { 'a' : doA,
                       'b' : doB,
                       ... }

Other textbooks have covered this ground; you may want to look at them for 
inspriation.  Here's my favorite one now (it's not Python, but it's good 


More information about the Tutor mailing list