functions for reading command-line input with type checking and optional value checking
Project description
This module defines several general-purpose functions:
- The functions `get_bool`, `get_int`, `get_float`, and `get_str` facilitate the
reading interactive input from the command line, with type checks and optional
value checks on the user input. (The Python Standard Library provides a rather
minimal capability for reading command-line input).
- The function `make_check` generates a function as its output; the generated
function tests a value against an arbitrary condition, and can be passed to any
of the above command-line input functions.
- The function `str2int` converts a string to an integer, with somewhat more
flexible rules for input formatting than those imposed by Python's `int`
function.
- The functions `get_bool`, `get_int`, `get_float`, and `get_str` facilitate the
reading interactive input from the command line, with type checks and optional
value checks on the user input. (The Python Standard Library provides a rather
minimal capability for reading command-line input).
- The function `make_check` generates a function as its output; the generated
function tests a value against an arbitrary condition, and can be passed to any
of the above command-line input functions.
- The function `str2int` converts a string to an integer, with somewhat more
flexible rules for input formatting than those imposed by Python's `int`
function.