Which Python IDE can run my script line-by-line?

后端 未结 15 776
小鲜肉
小鲜肉 2021-02-01 02:38

I wouldn\'t call myself programmer, but I\'ve started learning Python recently and really enjoy it.

I mainly use it for small tasks so far - scripting, text processing,

相关标签:
15条回答
  • 2021-02-01 03:00

    I use Notepad++ for most of my Windows based Python development and for debugging I use Winpdb. It's a cross platform GUI based debugger. You can actually setup a keyboard shortcut in Notepad++ to launch the debugger on your current script:

    To do this go to "Run" -> "Run ..." in the menu and enter the following, making sure the path points to your winpdb_.pyw file:

    C:\python26\Scripts\winpdb_.pyw "$(FULL_CURRENT_PATH)"
    

    Then choose "Save..." and pick a shortcut that you wish to use to launch the debugger.

    PS: You can also setup a shortcut to execute your python scripts similarly using this string instead:

    C:\python26\python.exe "$(FULL_CURRENT_PATH)"
    
    0 讨论(0)
  • 2021-02-01 03:03

    Rodeo seems to be new contender on the IDE market and the docs indicate that running lines of code is possible. I also have to admit it looks and behaves pretty good so far!

    0 讨论(0)
  • 2021-02-01 03:07

    If you like R's layout. I highly recommend trying out Spyder. If you are using windows, try out Python(x,y). It is a package with a few different editors and a lot of common extra modules like scipy and numpy.

    0 讨论(0)
  • 2021-02-01 03:07

    WingIDE, I've been using it successfully for over a year, and very pleased with it.

    0 讨论(0)
  • 2021-02-01 03:08

    I would plump for EMACS all round.

    If you're looking for a function to run code line by line (or a region if you have one highlighted), try adding this to your .emacs (I'm using python.el and Pymacs):

    ;; send current line to *Python
    (defun my-python-send-region (&optional beg end)
    (interactive)
    (let ((beg (cond (beg beg)
                   ((region-active-p)
                    (region-beginning))
                   (t (line-beginning-position))))
        (end (cond (end end)
                   ((region-active-p)
                    (copy-marker (region-end)))
                   (t (line-end-position)))))
    (python-shell-send-region beg end)))
    
    (add-hook 'python-mode-hook
          '(lambda()
             (local-set-key [(shift return)] 'my-python-send-region)))
    

    I've bound it to [shift-Return]. This is borrowed from here. There's a similar keybinding for running .R files line by line here. I find both handy.

    0 讨论(0)
  • 2021-02-01 03:09

    Take the hint: The basic Python Read-Execute-Print-Loop (REPL) must work.

    Want Evidence?

    Here it is: The IDE's don't offer much of an alternative. If REPL wasn't effective, there's be lots of very cool alternatives. Since REPL is so effective, there are few alternatives.

    Note that languages like Java must have a step-by-step debugger because there's no REPL.

    Here's the other hint.

    If you design your code well, you can import your libraries of functions and classes and exercise them in REPL model. Many, many Python packages are documented by exercising the package at the REPL level and copying the interactions.

    The Django documentation -- as one example -- has a lot of interactive sessions that demonstrate how the parts work together at the REPL prompt.

    This isn't very GUI. There's little pointing and clicking. But it seems to be effective.

    0 讨论(0)
提交回复
热议问题