True/False/None are not colored


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.


Zooba wrote Aug 22, 2012 at 3: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 4: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 8:12 AM


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

mlewand wrote Jan 26 at 3:13 PM

Is this issue resolved? Though True/False are colorec correctly, None still is not highlighted.

Zooba wrote Jan 27 at 11:18 PM

None is highlighted using different rules - if you customize colours then it's "Python builtins" rather than "Python keywords". In Python 2.x all three words are builtins rather than keywords, but in Python 3.x True and False are keywords. The default colour in the default theme for builtins is black, which is why they look uncoloured.

In actual fact though, None is always a keyword, so we should be highlighting it as such.