[Edu-sig] Python for Beginners

kirby urner kirby.urner at gmail.com
Mon May 26 18:14:37 CEST 2008


<< SNIP >>

>  a dictionary object is just a collection of sticky-notes
>
>
> -John Posner
>
>

One program I've been meaning to write, but haven't gotten to yet,
creates arbitrarily deep, legal data structures, with "easter egg"
or "treasure" randomly buried.  The output would be such as:

puzzle = {1:[{},([],'a')],(0,):["X"]} -- except it might go on for
several pages of nesting.

In this case, the object is to name 'X' and the solution is easy:
>>> puzzle[(0,)][0]
'X'

One point of this exercise is to help students construct a mental
model of pointers to pointers, much as C students do (in their
different semantic model of what "pointer" means).

Kirby


More information about the Edu-sig mailing list