Validation in RPC call?

Terry Reedy tjreedy at udel.edu
Mon Sep 7 13:32:22 EDT 2009


Phillip B Oldham wrote:
> I'm building an RPC service, and I need to validate the input and
> provide informative error messages to users. What would be the best
> way to do this? Simple `if` statements each raising a custom
> exception? `assert` statements inside a try/except block to
> "translate" the assertion errors into something more meaningful?

Use 'if'. Asserts are for debugging program logic (and hence can be 
optimized away), not for user input.




More information about the Python-list mailing list