Copy-paste into Python interactive interpreter and indentation -


this piece of code, test.py:

if 1:    print "foo" print "bar" 

can succesfully executed execfile("test.py") or python test.py, when 1 tries copy-paste python interpreter:

file "<stdin>", line 3 print "bar"         ^ syntaxerror: invalid syntax 

why so? can interpreter configured in such way read copy-pasted text succesfully? guess may affect typing in interpreter, that's ok me.

indentation lost or broken.

have @ ipython -- it's enhanced python interpreter many convenient features. 1 of them magic function %paste allows paste multiple lines of code.

it has tab-completion, auto-indentation.. , many more. have @ site.


using %paste in ipython:

enter image description here

and copy-and-paste stuff 1 of things fixed in qt console, here's using plain old copy-and-paste of code block "just works" in new ipython qtconsole:

enter image description here


Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -