I\'ve read about when to use assert vs. exceptions, but I\'m still not \"getting it\". It seems like whenever I think I\'m in a situation where I should use assert, later on in
A good example is checking the arguments of a function for consistency:
def f(probability_vector, positive_number):
assert sum(probability_vector) == 1., "probability vectors have to sum to 1"
assert positive_number >= 0., "positive_number should be positive"
# body of function goes here