On 24/08/11 21:03, Prasad, Ramit wrote:
I was under the impression that asserts are more for testing
> than for production code

That's true.

def overide_options(self, options, run_id=None):

         if not isinstance(options, dict):
                 raise TypeError("override options requires a dict")

This is good if you want to keep the check in for production.
But using an assert here while testing then removing it from production would be a valid use too. The typecheck is not required for the function to work if you are confident of the data being passed in. assert checks the data while you are gaining that confidence.

So either approach is valid.
It all depends on how variable your input data is going to be.


--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/

_______________________________________________
Tutor maillist  -  [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to