22

Resolved

True/False/None are not colored

description

Python tools does not appear to recognize and color the following keywords: True, False, None
Whetever this is a bug or simply an oversight, i cannot say.

Nor does MSVC++ respect custom keywords per usertype.dat in python files, whetever this is a shortcoming of Visual Studio or Python Tools, I cannot say.

comments

Zooba wrote Aug 22, 2012 at 4:40 PM

[I renamed the issue and marked it as a feature. At the moment, we deliberately do not colorize those variables, but we are heavily influenced by community demand as measured by votes.]

True, False and None are global variables and not keywords (try doing "type(True); type(None); type(if)"). None is a special case in that it cannot be reassigned, but you can freely set True and False to anything you like (please don't :) ).

The usertype.dat file seems to be a C++ feature. Since each language is implemented separately there's no automatic sharing of features - we'd have to implement this ourselves.

What we may be able to do is to provide a separate color for known "constants," which you could then choose to set to the keyword color. We probably have enough analysis info to color all variables with only one assignment as constants, which could be helpful feedback.

dinov wrote Aug 22, 2012 at 5:10 PM

If you change the language version to 3.x we also properly highlight True and False, but it looks like there's a bug that None doesn't get highlighted.

MariusM00 wrote Aug 29, 2012 at 9:12 AM

Thanks.

Though I'm unable to switch to python 3.x, at least I stand corrected on them being keywords.