I often see Python code that accepts a variety of inputs...
file names
s = Something("/Users/me/my_file.txt")
file paths
s = Something("my_file.txt")
or file objects
f = open("my_file.txt", "r")
s = Something(f)
Is there a convention to this?
As a lot of people mentioned, it depends on what something() is. What situations are better suited to file names vs. file objects?
I wonder if this SO post gives the best answer.
something()is doing, whether it is checking the type of argument being passed or not.