¶¶Ňő̽̽

Syntax highlighting

Author

Clayton Cafiero

Published

2025-01-05

What is “syntax highlighting”?

If you’re using an IDE, no doubt you’ve noticed that as you type code in it changes color. This is what’s called “syntax highlighting”, and it’s done automatically by virtually all modern IDEs.

Its purpose is to give visual cues to the programmer and anyone reading the code.

It’s important to understand that the colors applied are not part of the code—they are applied dynamically in the editor window of your IDE, and are not saved as part of your source code files. So this coloring has no significance for Python, but serves only as an aid to those reading the code.

Syntax highlighting helps the reader distinguish between

  • strings
  • numeric literals
  • Python keywords
  • Python built-in functions
  • identifiers (e.g., names)
  • constants
  • comments
  • TODO items
  • etc.

Copyright © 2023–2025 Clayton Cafiero

No generative AI was used in producing this material. This was written the old-fashioned way.

Reuse