Skip to main content

python-input-validation

#post

A Pythonic approach to input validation

  • this Reddit discussion included assertions that it isn’t in keeping with python’s type hinting intentions to “look before you leap” or engage in the type of “type widening” that happens when you start with object (no assumptions made) and prove you can widen to a type with more capabilities (e.g. is_str)
  • is my “start from unknown and test every assumption” not the only approach to validating user input data?
  • what’s a more pythonic way to do that?
  • is it just a matter of try/except handling instead of starting with explicit input validation?
  • Ask guild Python the title of this post