[Edu-sig] Pythonic "case statement"

kirby urner kirby.urner at gmail.com
Thu Jun 15 04:35:12 CEST 2006


>     # dispatch to the appropriate function
>     dict(GET=get, POST=post, PUT=put, DELETE=delete)[method](arg)
>

Very cool Dethe.  This equals sign form of dict is one I can't recall seeing.

And yes:  "dispatch" is the appropriate word to be using here.

I have encouraged Bernie to think about returning geochemical data in
the form of web pages, in response to various queries.  Maybe he'll
file your example of a little CGI script for later.

Bernie is frustrated by the low level of awareness many geochemists
have of how computers could be helping them.  I regard this as a
failure of CS more than of geochemistry -- mainly because CS is what
we're in a position to influence on edu-sig, less so the earth
sciences.

Kirby


More information about the Edu-sig mailing list