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]
# ... interesting code
return obj_of_interest
You'll note that foo()
can function perfectly regardless of whether it's passed spam
as a list, as a tuple, or really as anything that enforces an order to the element and can be addressed like a list.
How do you document this fact without telling the user to use a specific type?
You say,
"""spam is an object that supports indexing."""
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With