Ben Finney <[email protected]> writes:
[...]
> commands = {
> 'q': (lambda: quit()),
> 'c': (lambda: prompt_and_convert_temperature(
> ["Celsius", "Fahrenheit"], celsius_to_fahrenheit)),
> 'f': (lambda: prompt_and_convert_temperature(
> ["Fahrenheit", "Celsius"], fahrenheit_to_celsius)),
None: print_commands,
> }
>
>
> if __name__ == '__main__':
> choice = None
> while choice is None:
> choice = raw_input("Command: ")
commands.get(choice)()
--
Arnaud
--
http://mail.python.org/mailman/listinfo/python-list