[Tutor] Issue w/ string input "for", "not", "while", "else" etc.

Steven D'Aprano steve at pearwood.info
Tue Nov 26 23:39:06 CET 2013


On Tue, Nov 26, 2013 at 04:57:56PM +0000, Alan Gauld wrote:
> On 26/11/13 16:49, Peter Otten wrote:
> 
> >>When executing the program, in case the user input is "for", "not",
> >>"True", "while" Python interprets that as a command and changes the
> >>input's color to the corresponding command.
> ...
> >
> >Are you running the program inside idle? The (in this case unwanted) syntax
> >highlighting is a feature of idle's shell.
> 
> Good catch, I didn't notice that Rafael was only complaining about the 
> colorizing of his text. I assumed it was actually executing the input.
> I suspect the colorizing happens in most IDEs not just IDLE?

Nope. I've just tested it in bpython, and it colorizes strings 
correctly. It's a bug in IDLE if it colorizes strings as keywords.


-- 
Steven


More information about the Tutor mailing list