[Python-Dev] confusing exec error message in 3.0 (original) (raw)
Isaac Morland ijmorlan at cs.uwaterloo.ca
Fri Aug 29 03:50:14 CEST 2008
- Previous message: [Python-Dev] confusing exec error message in 3.0
- Next message: [Python-Dev] Reference leak in thread._local
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Fri, 29 Aug 2008, Greg Ewing wrote:
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?
I think .source is a much better idea. It's more explicit to start with, and on top of that it can simply be None when there is no source file available, which is much more explicit than "file not found means no source file available". Also, if a feature is ever added to allow telling Python to put the compiled files in a separate tree (like javac -d directory in the Java universe) then it will be even more clear that computing the source location from file is not the way to go.
PS, in case it's not clear, I want that feature, in order to keep .pyc files out of my SVN checkouts. I hate having automatically generated files in my workspace.
Isaac Morland CSCF Web Guru DC 2554C, x36650 WWW Software Specialist
- Previous message: [Python-Dev] confusing exec error message in 3.0
- Next message: [Python-Dev] Reference leak in thread._local
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]