break in a module
Erik Max Francis
max at alcyone.com
Thu Jun 16 18:09:19 EDT 2011
Eric Snow wrote:
> Like I said, my main motivation is to reduce my levels of indentation
> somewhat. I was trying to see if I could apply a pattern I use in
> functions and loops to modules.
If your sole goal here is to reduce clutter, then turn a repeated
if/elif/else case into a dictionary lookup where the keys are functions,
and execute the value. Even then, unless there are quite a lot of
cases, this may be overkill.
--
Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/
San Jose, CA, USA && 37 18 N 121 57 W && AIM/Y!M/Skype erikmaxfrancis
I am not afraid / To be a lone Bohemian
-- Lamya
More information about the Python-list
mailing list