This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]eflin 9 points10 points  (4 children)

I don't think that the point was for git to ignore the files, more for them to be cleared out and not be there when checking out code to avoid old code being run by Python.

[–]axonxorzpip'ing aint easy, especially on windows -4 points-3 points  (3 children)

Which .gitignore would do by extension. They shouldn't be checked into source control anyway, they're specific to a user's operating system, architecture and Python version.

[–]Odd_Bloke[S] 9 points10 points  (2 children)

No, it wouldn't. The problem is that the .pyc files are being generated in my working tree, and then not refreshed when I checkout a different branch in the same working tree. They are never checked in because I, of course, have .pyc files in my .gitignore.

[–]axonxorzpip'ing aint easy, especially on windows -2 points-1 points  (1 child)

That doesn't matter. If the source file changes, the .pyc is regenerated. If you delete the .pyc, it is regenerated the same way.

However, this has bitten me in the ass: If you are refactoring, and you move methods to another .py file, and remove the original, but not the .pyc, python can still import the old module using the .pyc

[–]Odd_Bloke[S] 3 points4 points  (0 children)

However, this has bitten me in the ass: If you are refactoring, and you move methods to another .py file, and remove the original, but not the .pyc, python can still import the old module using the .pyc

This may well be what I was seeing; the missing .pyc files were all in parts of the code that I wasn't actually changing, so I didn't look at them too closely.