4 ms·
Hah. .pyc files are one of the worst part of Python for developers. export PYTHONDONTWRITEBYTECODE=true is the first thing anyone should be doing. I guess it
by JulianWasTaken 11y ago
Hah. .pyc files are one of the worst part of Python for developers.
export PYTHONDONTWRITEBYTECODE=true is the first thing anyone should be doing.
I guess it figures that we copy each others' mistakes.
- michaelmior 11y agoI've been coding in Python for many years and I can count on one hand the number of times that this has actually caused me any problems.
- JulianWasTaken 11y agoWhat is the total amount of time you spent during those few times, although including the amount of time to learn what happened, and how many thousands of times larger is that amount than the sum total of the time saved by caching bytecode compilation every single time you loaded a pyc for every file you ever wrote?
- michaelmior 11y agoProbably a few minutes spent. I'm not sure how to quantify the overhead of caching compiled bytecode, but I'm guessing it beats that.
- JulianWasTaken 11y agoIt doesn't, which was my point :) The overhead is tiny, less than milliseconds for sane modules. It's a useless optimization, especially when it can be done at install time only, say, as opposed to for every module import, but even that is somewhat silly.
- michaelmior 11y agoWithout seeing any numbers, it doesn't mean much to me. I'm assuming someone much smarter than me has identified the benefit of bytecode caching and unless it really gets in my way, I see no need to do away with it.
- gerner 11y agocan you be more specific?
- robbles 11y agoRefactoring a module to a package (e.g. mymodule.py -> mymodule/__init__.py) can cause errors if you don't clear the bytecode, since it can pick up mymodule.pyc and fail to see the new files. Not sure about the exact conditions when this occurs, but it's definitely happened to me when code is refactored and you pull the newest version in with git.