What exception to raise for python function arguments -


i'm creating function right takes in 2 lists. want these 2 lists of equal size. i'm trying figure out kind of exception should throw (or if should throw exception @ all) if aren't same size. kind of want valueerror check doesn't pertain single value.

for clarities sake, here's function stub.

def create_form(field_types, field_discriptions):     pass 

i use assert , raise assertionerror:

assert len(field_types) == len(field_descriptions), "helpful message" 

otherwise, valueerror message seems best choice.


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

How to get multiresult with multicondition in Sql Server -