I accidentally wrote code that effectively did this:
with open(1) as f:
for line in f:
print(line)
This did not throw an error on opening 1 (not a string, but an actual integer), and then hung on for line in f. What exactly is happening here, and why does the open not throw an exception?
Note: What I really wrote was with open(filepath) as f:, and due to a bug I accidentally set filepath to an integer. I don't expect this to come up frequently, but I was surprised that I didn't get an error.