Open oconnor663 opened 10 years ago
I just played with this for an hour. It works, but I'm not sure it really results in less code, once you add in good error messages for all the cases. I'm worried it's actually harder to read than regular python. There are also some difficulties like, can you automatically parse out Module
objects when the name is a key and the contents are a value? Probably not, so there would still need to be some custom parsing logic after everything's been validated. Closing for now.
Rather than using a Python-specific library, it might be a good idea to use a more generic schema format, like JSON Schema, that lets us express our schemas as data rather than code. There seems to be a good Python implementation.
https://github.com/halst/schema Same guy who wrote Docopt.
Others: https://github.com/alecthomas/voluptuous https://github.com/Julian/jsonschema https://github.com/podio/valideer