[Yum] Future feature request...

seth vidal skvidal at phy.duke.edu
Wed Nov 12 13:47:24 UTC 2003


> I know you were just joking (the smiley gave it away) but there is a
> tidy solution to the "endless if" problem.
> 
> Make a dict[] of names->functions.  This makes the whole thing rather
> modular and tidy.  Define the functions wherever you want, including
> 'plugins' if you like.  In one place, you stick them all into the
> dict, and then you just do:
> 
>   try:
>       command_dict[command_name](command_args)
>   except KeyError:
>       print "no such command"

So just to respond in kind:

when I build up that dict I'd need:


command {name: function
         name2: function2
         name3: function3
         ...
         name80:function80}

Yah, that's not ugly at all.

riiiiiiiiiiiight
-sv





More information about the Yum mailing list