Validation in Python (was: raise None)
Ben Finney
ben+python at benfinney.id.au
Wed Dec 30 19:26:14 EST 2015
Steven D'Aprano <steve at pearwood.info> writes:
> I have a lot of functions that perform the same argument checking each
> time:
Not an answer to the question you ask, but: Have you tried the data
validation library “voluptuous”?
Voluptuous, despite the name, is a Python data validation library.
It is primarily intended for validating data coming into Python as
JSON, YAML, etc.
It has three goals:
Simplicity.
Support for complex data structures.
Provide useful error messages.
<URL:https://pypi.python.org/pypi/voluptuous/>
Seems like a good way to follow Don't Repeat Yourself in code that needs
a lot of validation of inputs.
--
\ “It's my belief we developed language because of our deep inner |
`\ need to complain.” —Jane Wagner, via Lily Tomlin |
_o__) |
Ben Finney
More information about the Python-list
mailing list