[Edu-sig] Rich Data Structures

Kirby Urner urnerk at python.org
Wed Oct 5 20:51:09 CEST 2005


>     'Saturn': ['Pan','Atlas','Prometheus','Pandora',
>                'Epimetheus','Janus','Mimas','Enceladus',
>                'Tethys','Telesto','Calypso','Dione',
>                'Helene','Rhea','Titan','Hyperion',
>                'Iapetus','Phoebe'],
>     'Uranus': ['Cordelia','Ophelia','Bianca','Cressida',
>                'Desdemonia','Juliet','Portia','Rosalind',
>                'Belinda','Puck'
> 

We might further enrich this module with additional lookup tables.  Now that
we know how to get the moons of Saturn i.e. solarsystem.moons['Saturn'] --
case sensitive -- we could consult a lookup table of URIs:

>>> solarsystem.getlookuptable('moonurls')['Mimas'] # function returns dict
'http://ksiezyce.republika.pl/saturn/mimas_en.html'

We might then invoke the Standard Library to pull down actual source HTML
and/or embedded images (if any).  We could use the pictures in later
exercises.

Or maybe not.  Lots of ways to go.  One module could be about solar system
data structures.  All these nested objects, maybe with numerical data
involving diameters, distances, periods of orbit and rotation, average
surface temperatures -- there's no upper limit on how detailed one might
want to get.  But for ordinary classroom use, there's no need to parse
through a whole gigabyte of solar system data structures, as we still have
mammals and species of phytoplankton to consider.

So I imagine CDs with tons of already defined rich data structures, in the
form of Python modules, plus other languages could do it too.  The CDs would
be a convenience for when you're not on the web, but would mirror content at
websites.  This way, tutorial writers, book authors, could reference these
standard in-common data sources, even while doing original writing for
compensation, i.e. here's a mix of for-profit and in-common code.  And
profiteers give back to the in-commons, having seen how useful it's been.

Kirby




More information about the Edu-sig mailing list