Suppose I have a list/tuple of strings,
COLOURS = [
"White",
"Black",
"Red"
"Green",
"Blue"
]
for c in COLOURS:
# rest of the code
Sometimes I forget placing a comma after each entry in the list ("Red" in the above snippet). This results in one "RedGreen" instead of two separate "Red" and "Green" list items.
Since this is valid Python, no IDE/text editor shows a warning/error. The incorrect value comes to the limelight only during testing.
What writing style or code structure should I use to prevent this?