At 04:30 AM 12/25/2005, linda.s wrote: >is there any tool like "run line or selection" in Pythonwin?
Shades of Visual FoxPro? Create a script (I call it testbed.py). Open it in a script window, paste the selection there, hit F5. Since this executes in the main namespace the results will persist. It is fairly easy to use ctrl-a followed by ctrl-v to replace any prior script with the newly copied selection. Then you can play with it in the testbed and put back in the "real" script when you ar happy with it. FWIW before discovering this I would copy/paste into immediate window, and either string the lines together by putting ; at the end, the deleting the return or editing in ... before all continuation lines as follows: Example in script: a = 3 b = 4 print a+b Paste in immediate: >>> a = 3 b = 4 print a+b Edit and execute (need to hit enter twice): >>> a = 3; b = 4; print a+b If compound statements are involved I paste then type ... at the start of the 2nd line, copy that and paste in front of the remaining lines. These operations are fairly quick. Example 2 in script: if a == b: print 'Winner" c = b y = z Paste in immediate: >>> if a == b: print 'Winner" c = b y = z Type ... at left margin of print line and subsequent lines or copy & paste, then execute (need to hit enter twice). These operations are fairly quick. >>> if a == b: ... print 'Winner" ... c = b ... y = z hth Since all these approaches execute in the main namespace their results will persist. _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor