Steven D'Aprano <[email protected]> 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
--
https://mail.python.org/mailman/listinfo/python-list