Is the color hue of a variable in VS Code telling me something?
Question:
I have noticed a little curiosity in VS Code with a Python script I am writing:
I have some function that returns a numpy
matrix B
along with a list of parameters called parameters
. In the editor, the blue hue of B
is a slightly darker color than the one for parameters
. This also happens for all caps variable names, like ABC
, but not when starting with a capital letters and then switching to lowercase, or for a single character lowercase variable name like b
.
Here are some screenshots:
Zooming in on this screenshot confirms that the colors are slightly different (”dark” blue is #44c1ff
with a #1e59c5
shadow, while the lighter blue is #7cdcf0
with a #1e1ea7
shadow).
My question is: is VS Code trying to tell me something with this slight color discrepancy? Am I violating some variable naming guidelines unknowingly?
What I tried: Changed variable names around, got different color hues, code executes the same regardless of color.
Answers:
PEP-8 specifies these relevant naming conventions:
lowercase
for variable names
CapWords
for class names
UPPERCASE
for constants
VS Code is highlighting constants differently.
I have noticed a little curiosity in VS Code with a Python script I am writing:
I have some function that returns a numpy
matrix B
along with a list of parameters called parameters
. In the editor, the blue hue of B
is a slightly darker color than the one for parameters
. This also happens for all caps variable names, like ABC
, but not when starting with a capital letters and then switching to lowercase, or for a single character lowercase variable name like b
.
Here are some screenshots:
Zooming in on this screenshot confirms that the colors are slightly different (”dark” blue is #44c1ff
with a #1e59c5
shadow, while the lighter blue is #7cdcf0
with a #1e1ea7
shadow).
My question is: is VS Code trying to tell me something with this slight color discrepancy? Am I violating some variable naming guidelines unknowingly?
What I tried: Changed variable names around, got different color hues, code executes the same regardless of color.
PEP-8 specifies these relevant naming conventions:
lowercase
for variable namesCapWords
for class namesUPPERCASE
for constants
VS Code is highlighting constants differently.