Steven D'Aprano wrote:

I don't think M.__file__ should lie and say it was loaded from a file that it wasn't loaded from. It's useful to be able to look at a module and see what file it was actually loaded from.

On the other hand, it could be useful to be able to find
the source file for a module, regardless of whether it
was loaded from a .py, .pyc or .pyo.

Maybe there should be a __source__ attribute for that?

Or is os.path.splitext(M.__file__)[0] + ".py" considered
good enough for that?

--
Greg
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to