On 5/28/14 10:22 PM, Steven D'Aprano wrote:
If you want to use python as a shell-glue you can try using system.

  >>> from os import system
  >>> def <function_name>([parms])
  >>> .... blah blah
  >>> .... rc = system("<your_script_name")

os.system is cool for quick and dirty calls to an external command. But
for serious work, the subprocess module is better.

   ... yup, particularly for non trivial network related stuff.

Neither here nor there, but I just learned the ";" character command today for the Julia REPL, and got to thinking that python should have a similar way for the REPL to drop into "shell" mode for system commands.

So, I might code a clear screen in python:

def cls()
   rc = system("clear")

or in Julia

function cls()

...  but on Julia we can also do this:

; clear

On the Julia REPL the ";" character drops the julia prompt into shell. I think the IDLE REPL should have a system shell mode. What say you?



Reply via email to