What is the difference between "py[cod]" and "pyc" in .gitignore notation?

Question:

What is the difference (if any) between “.pyc” and “.py[cod]” notation in ignoring files. I am noticing I have both on my git ignore file. Thanks

Asked By: BluePython

||

Answers:

You are safe to remove the .pyc entry from your .gitignore, since .py[cod] will cover it. The square brackets are for matching any one of the characters, so it matches .pyc, .pyo and .pyd.

Since they are all generated from the .py source, they should not be stored in source control.

Answered By: T Percival
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.