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.
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to