This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Idea: Add a flag to reload from source, e.g. reload(module, ignore_pyc=True)
Type: Stage:
Components: IO Versions:
process
Status: closed Resolution: works for me
Dependencies: Superseder:
Assigned To: Nosy List: brett.cannon, timClicks
Priority: normal Keywords:

Created on 2012-02-21 03:00 by timClicks, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (5)
msg153839 - (view) Author: Tim McNamara (timClicks) * Date: 2012-02-21 03:00
When developing Python code, I often find myself needing to run "rm *.pyc" so that the interpreter will ignore any new changes that I have made to source files. It's really frustrating when forgotten.

Adding a flag to the reload builtin would go a long way to simplify this process.
msg153887 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2012-02-21 18:10
I don't quite follow what you want. You say you want to *ignore* changes to source files, but that's the whole point of a reload. And I don't see how ignoring bytecode changes anything unless you are mucking with bytecode formats and don't want to have to continuously change the magic number.
msg153888 - (view) Author: Tim McNamara (timClicks) * Date: 2012-02-21 18:14
No no, I don't want to ignore source files. I want to be able to change a .py file, then reload in the Python shell and for the changes to be applied.

At the moment, .pyc files within a project complicate this.
msg153892 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2012-02-21 18:54
Then I'm not understanding the problem as changes to source trump .pyc files in a reload(). It should make no difference that .pyc files even exist to a reload() as long as source is around.
msg164533 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2012-07-02 19:28
Never heard back from OP.
History
Date User Action Args
2022-04-11 14:57:26adminsetgithub: 58278
2012-07-02 19:28:51brett.cannonsetstatus: pending -> closed
resolution: works for me
messages: + msg164533
2012-02-21 18:54:26brett.cannonsetstatus: open -> pending

messages: + msg153892
2012-02-21 18:14:25timClickssetmessages: + msg153888
2012-02-21 18:10:04brett.cannonsetnosy: + brett.cannon
messages: + msg153887
2012-02-21 10:29:39timClickssettitle: reload(module, ignore_pyc=True) flag -> Idea: Add a flag to reload from source, e.g. reload(module, ignore_pyc=True)
2012-02-21 03:00:20timClickscreate