Author terry.reedy
Recipients epaine, terry.reedy, wyz23x2
Date 2020-07-29.13:31:12
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
I disagree.  IDLE already shows a note -- in the editor window -- with the first noted divergence from python code marked.  We are trying to keep IDLE relatively simple and not clutter it with trivial options.

ispythonsource is just a guess.  The decision is whether turn on the colorizer and do python indents.  For a new file, assume that it will be python code.  Returning True for a directory is an error that is never hit as directories are not opened.  Python files do not have to have a .py extensions, and files that have a .py extension do not have to be python files.  But IDLE encourages use of the convention.

I would consider adding a note to the SyntaxError box when the error is on the first line.  Something like "Is this really a Python code file?"

  The only actual running of non-Python files I have seen reported, and I believe at least twice, is very beginner beginners running the saved Shell log, which begins "Python 3.x...", with the 3 highlighted.  If this were recognized, the message might be "If this is a log of an interactive session, you cannot run it."

But I am not sure if this would really solve the problem of extreme ignorance.  And anything added would have to have a test, and would be a possible maintenance burden.
Date User Action Args
2020-07-29 13:31:13terry.reedysetrecipients: + terry.reedy, wyz23x2, epaine
2020-07-29 13:31:12terry.reedysetmessageid: <>
2020-07-29 13:31:12terry.reedylinkissue41434 messages
2020-07-29 13:31:12terry.reedycreate