def foo(spam, obj_of_interest): """Pass a _____ and an object of interest, and return [something that does something worthwhile] """ name = spam[0] quest = spam[1] fav_color = spam[2]
You will notice that foo() can function perfectly regardless of whether it passed spam as a list, as a tuple, or really as something that provides order for the element and can be addressed as a list.
How do you document this fact without telling the user to use a particular type?
source share