[Tutor] Sys.argv read parameters

Dave Angel davea at davea.name
Wed Apr 17 23:24:59 CEST 2013


On 04/17/2013 05:15 PM, Danny Yoo wrote:
> Yup!  Sorry about my tone for its stridency.  But I just got concerned
> that the original poster seemed content about turning the chain of if
> statements into a table definition.  To my mind, they're very closely
> related, data and control.  I'm trying to push the OP to realizing
> that if they are doing this, they are still enumerating all the
> decisions.  Maybe it's not in the form of a chain of if statements,
> but it's still reflected in the structure of the table.
>
> (It's the same reason I get concerned when I see students not
> recognize the similarities between if statements and polymorphism:
> it's all about transmogrifying control flow and data structures.)
>
> Let me say that if there's non-uniformity among the choices, then the
> table lookup approach (a dispatch table) is probably the right tool.
> If there's uniformity, then a computational approach should be
> considered.
>
>

But look at the original question.  It was about having many variables. 
  And a dict is the way to take many variables out of the namespace and 
replacing them with one.  And it was unlikely to my mind that the final 
intent was to produce such a simplistic message for each letter.

-- 
DaveA


More information about the Tutor mailing list