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:

  1. clear logical blocks, easier maintain
  2. module importable , doesn't run portion of code unless call functions
  3. 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

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

c# - Resource not found error -