[Pydev-code] Use of cmd == 'onSave' bad for development?
Brought to you by:
fabioz
From: Joel H. <yo...@if...> - 2006-04-19 12:53:22
|
Hi! From my assign params to attribs script: # 'onSave' can be added to the list for developing purposes. if cmd in ['onCreateActions', 'onSave']: declare_lots_of_variables_and_stuff Using 'onSave' in this manner isn't terribly clever, is it? Say that I delclare a variable and use it in a bunch of places, save and run and discover an error. Say that in the process of fixing the error I change the variable, but forget to change it *everywhere*. When I save and retry, the error may seem to be fixed, because the old value is still in memory and does not cause a NameError or such until I restart the editor. Or is there something that I missed? The reason I added 'onSave' for development is pure laziness. It's quicker to save-to-update than to restart-to-update. Is there an easy way of provoking an editor restart in eclipse/pydev, so that the scripting namespace is cleared? As you already have pointed out, I should take care not to mess around with globals and to be careful to not use stuff imported to other scripts, but is there anything else I should do to avoid this pitfall that I seem to fall into again and again? Thanks a bunch for your help! Take care! /Joel Joel Hedlund wrote: > Hi! > > Would it be a good idea to add the "location of additional jydev scripts" to > the PYTHONPATH for pydev jython scripts by default? That way it would be easier > to put commonly used functionality for pydev scripting (such as your jython dir > utils) in their own modules. > > This is my sys.path in pydev jython scripts: > ['.', '/usr/local/lib/eclipse/plugins/org.python.pydev.jython_1.0.4/Lib', > '/usr/local/lib/eclipse/plugins/org.python.pydev.jython_1.0.4/jysrc'] > > '.' in this case is my home dir. > > Cheers! > /Joel Hedlund > > > ------------------------------------------------------- > This SF.Net email is sponsored by xPML, a groundbreaking scripting language > that extends applications into web and mobile media. Attend the live webcast > and join the prime developer group breaking into this new coding territory! > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 > _______________________________________________ > pydev-code mailing list > pyd...@li... > https://lists.sourceforge.net/lists/listinfo/pydev-code |