I've always assumed that the __file__
variable always gave you the current file name, but that doesn't seem to be exactly what it does. Since I've been facing a bug if I assume this to be true.
Someone told me "that __file__
refers to the last module searched"
And this seems to be more accurate, but I'd like to know what __file__
is really supposed to do.
I couldn't find anything concrete mentioned in the Python docs. A lot places seem to mention it, but aren't very clear about it.
http://docs.python.org/2/c-api/import.html?highlight=__file__
http://docs.python.org/2/c-api/module.html?highlight=__file__