Why does basename return the compiled filename?
<p>Running <code>os.path.basename(__file__)</code> sometimes give me the filename as <code>foo.py</code>, but other times it gives <code>foo.pyc</code>. I understand that the pyc is the compiled file, which is then probably used everytime after it was compiled. I'm just confused as to why the <code>basename</code> returns the pyc filename? Is that normal? Secondly, how can I make it always return the uncompiled filename or without the extension?</p>