Why ELIF?

Esmail ebonak at hotmail.com
Mon Oct 12 08:16:37 EDT 2009


TerryP wrote:
>
> Somehow I doubt that "Look up X in dictionary D" could ever be more
> efficient (in terms of space and time, at least) then "Check if X is
> equal to Y". It's not about what you get in runtime but what you get
> in monkey time.
> 
> 
> Most expressions that would make someone reach for a C-like switch()
> statement can be expressed with dictionaries or attributes instead.
> 
> Here is a dorks approach to calling a specific function with arguments
> based on a command:
> 
<...>
> Here is more of a look up table approach:
<...>

Neat -- thanks for sharing this TerryP

Esmail




More information about the Python-list mailing list