Dynamically defined functions via exec in imported module

Fredrik Lundh fredrik at pythonware.com
Sat Aug 16 10:02:23 EDT 2008


Nadeem wrote:

> I understand that all this can be done with classes and OO
> programming, but the whole point of the HtDP curriculum is to
> introduce students to programming in a pedagogically-effective way
> using a functional approach instead of OO-first.

And yet, one of the HtDP authors just posted a paper that argues that 
it's time to abandon the whole idea of "programming language paradigms" 
in teaching, and focus on language features instead.

   Most books rigorously adhere to the sacred division of languages
   into "functional", "imperative", "object-oriented", and "logic"
   camps. I conjecture that this desire for taxonomy is an artifact
   of our science-envy from the early days of our discipline: a
   misguided attempt to follow the practice of science rather than
   its spirit.  We are, however, a science of the artificial. What
   else to make of a language like Python, Ruby, or Perl?  Their
   designers have no patience for the niceties of these Linnaean
   hierarchies; they borrow features as they wish, creating melanges
   that utterly defy characterization. How do we teach PL in this
   post-Linnaean era?

http://www.cs.brown.edu/~sk/Publications/Papers/Published/sk-teach-pl-post-linnaean/

Alright, his emphasis is on teaching programming language *design* 
features (and there's still the usual tone of "Scheme is right all the 
time and the others make mistakes all the time", despite the recent RS6S 
brouhaha ;-), but I'd say you should think twice before exposing your 
students to an absurdly artificial rendering of one language's model in 
another language's syntax.  It's trivial to show how Python's method 
*syntax* is used to associate ordinary functions with "attribute 
containers" without having to first introduce OO as a formal concept.

</F>




More information about the Python-list mailing list