claird at lairds.us
Mon Jan 17 21:08:04 CET 2005
In article <1105983271.574296.37740 at c13g2000cwb.googlegroups.com>,
Ben Sizer <kylotan at gmail.com> 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:
if x13.fluid_level() > lower_threshhold:
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.
More information about the Python-list