In article <[EMAIL PROTECTED]>,
Ben Sizer <[EMAIL PROTECTED]> wrote:
>But you could use a dict of return values, or even just assigning a
>different return value in each if clause. The end result is that you
>have a single well-defined exit point from the function, which is
>generally considered to be preferable.
>
Well, no; I'm trying to say exactly that there are times when "a dict
of return values" only adds complexity. Or perhaps I'm missing a bet-
way to code:
def condition_label():
if x13.fluid_level() > lower_threshhold:
return "OK"
if user in restricted_list:
return "Ask for help"
if not current_time.in_range(beginning, end):
return "Uncorrectable exception reported"
...
When conditions live in a space with higher dimensionality than any
handy immutable range, no dict-ification is a benefit.
--
http://mail.python.org/mailman/listinfo/python-list