In working on the doc change for <http://python.org/sf/919099> I came across this statement: The names in the module namespace are updated to point to any new or changed objects. Names of unchanged objects, or of objects no longer present in the new module, remain pointing at the old objects. (The bit about names of unchanged objects still pointing to the old objects is incorrect. I'll fix that.) Not believing that old objects remained after the reload() I wrote a short test: a = 5 b = 7 c = (1,2,3) imported it, modified it to a = 9 c = (1,2,3) then reloaded it. I was surprised to find that reloadtst.b did indeed still exist: >>> import reloadtst >>> dir(reloadtst) >>> dir(reloadtst) ['__builtins__', '__doc__', '__file__', '__name__', 'a', 'b', 'c'] >>> # edit reloadtst.py ... >>> reload(reloadtst) <module 'reloadtst' from 'reloadtst.py'> >>> dir(reloadtst) ['__builtins__', '__doc__', '__file__', '__name__', 'a', 'b', 'c'] It seems counterintuitive to me that reloadtst.b should still be defined. Is that behavior intention or accidental? Skip
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4