Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Is the color hue of a variable in VS Code telling me something?

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:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

original

all caps

one letter, lowercase

Capital starting letter

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.

>Solution :

PEP-8 specifies these relevant naming conventions:

  • lowercase for variable names
  • CapWords for class names
  • UPPERCASE for constants

VS Code is highlighting constants differently.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading