2 ms·
When I hit up I get: ^[[A Some other frustrations: reload() seems to not work on occasion(haven't figured out the pattern yet) Tab completion would be nice (I
by breck 18y ago
When I hit up I get: ^[[A
Some other frustrations: reload() seems to not work on occasion(haven't figured out the pattern yet)
Tab completion would be nice (I'm going to try the script above)
- tedshroyer 18y agoI think because of the way import works, that a reload wouldn't update anything that the module you're reloading imports. $echo -e "def foo():\n\tprint 'bar'" > a.py $echo -e "import a\ndef bar():\n\ta.foo()" > b.py $python Python 2.5.2 (r252:60911, Jul 31 2008, 17:28:52) >>>import b >>>b.bar() bar >>>f = open('a.py', 'w') >>>f.write("def foo():\n\tprint 'changed'") >>>f.close() >>>reload(b) <module 'b' from 'b.pyc'> >>> # Notice that it imported from 'b.pyc' not 'b.py' ... b.bar() bar >>>reload(a) Traceback (most recent call last): File "<stdin>", line 1, in <module> NameError: name 'a' is not defined >>>#But I need to update a ...reload(b.a) <module 'a' from 'a.py'> >>>#That loaded from 'a.py' ...b.bar() changed >>>exit() edit #You could have done it like this too >>>import a >>>import b >>>b.bar() bar >>>###Something changes a.py >>>reload(a) >>>b.bar() changed