eclipse - How can I select and run a block of python code? -
this question has answer here:
are there ides let me select block of code in python script , run selected code?
i'm using eclipse + pydev , can't figure out.
know how (run selection in script instead of running whole script)in eclipse?
thanks
i guess can done, why? if want experiment portion of code, possible approach is:
def a(): # wrap experimental code def b(): # wrap other experimental code if __name__ = '__main__': a() b() # next time
this approach delivers multiple advantages:
- clear logical blocks, easier maintain
- module importable , doesn't run portion of code unless call functions
- once development's mature, don't have tear down "experimental" module , rewrite - it's production ready
so instead of "select-and-run", "comment/uncomment-and-run". don't see how harder can :)
Comments
Post a Comment