[portland] Dictionary As Switch Statement

Rich Shepard rshepard at appl-ecosys.com
Fri Jan 18 02:18:28 CET 2008


On Thu, 17 Jan 2008, kirby urner wrote:

> Dictionaries very much don't care about order,

Kirby,

   That's what I thought when I saw the changed order. Similar to database
table rows not necessarily being in the same sequence.

> The only way to grab a single value that's not idiosyncratic is
> to reach in with a key, a string in your example e.g.:
>
> curvePlot[ 'Decay S-Curve' ]

   When I did this and saw None as a result I started looking for the reason
why.

> should return zCurve(self) but then I'm suspicious of why you
> have "self" mentioned, as that's normally not passed as an
> argument.  Are your functions or objects returning None then?

   I use 'self' because I thought that the function calls needed the trailing
parentheses to identify them as functions. When I did this, python told me
it was expecting 1 argument for each function and I supplied 0 arguments. So
I added 'self' and the incorrect argument number error went away.

Thank you,

Rich

-- 
Richard B. Shepard, Ph.D.               |  Integrity            Credibility
Applied Ecosystem Services, Inc.        |            Innovation
<http://www.appl-ecosys.com>     Voice: 503-667-4517      Fax: 503-667-8863


More information about the Portland mailing list