Function parameter types in Python
- by Leif Andersen
Unless I'm mistaken, creating a function in python works like this
def my_func(param1, param2):
/*stuff*/
However, you don't actually give the types of those parameters. Also, if I remember, python is a strongly typed language, as such, it seams like python shouldn't let you pass in a parameter of a different type then the function creator expected. However, how does python know that the user of the function is passing in the proper types? Or will the program just die if it's the wrong type, assuming the function actually uses the parameter? Or do you have to specify the type/I'm missing something?
Thank you.