[Tutor] Interpreter pasting Question

Alan Gauld alan.gauld at yahoo.co.uk
Fri Dec 28 14:43:08 EST 2018


On 28/12/2018 17:13, Avi Gross wrote:

> It sounds like the problem is that IDLE is (invisibly) intercepting what I
> type or paste and then passing it on to a slaved interpreter. There likely
> are other side effects and another editor/environment may not have this
> issue. I will try some.

Do not confuse the interactive prompt with the interpreter.
The prompt is unique to the tool and the interpreter is, ultimately,
used by the tool in the background. But each tool handles the
input differently before invoking the interpreter.

> As one of my programming styles includes lots of hands-on incremental
> analysis of bits and pieces to get them working before combining them,  I
> have no time for an idyllic experience.

Remember tat IDLE is not intended as an industrial strength
IDE  like Eclipse, Netbeans, VS or Blackadder etc it was
intended to be an easy to learn tool for beginners.

There are several tools that do what you want better than
IDLE - including IDLEX. (And if things go to plan many IDLEX
features will appear in the 3.7/3.8 versions of IDLE.)

But even IDLEX is not the last word in toolsets. There are
many alternatives including IPython and Jupyter etc.

> OK, just kidding. Nice to have choices and I particularly want to move on to
> using notebooks in which I can have batches of code I can run inline and
> even interleave bits of multiple languages. 

Sounds like you should take a look at IPython/Jupyter


> Now type
> 
> exec(Cmd)
> 
> May not work all the time, but perhaps a reasonable work around.

The biggest issue is that it requires the environment to
pre-exist - variables initialised sensibly, etc. But thats true of any
tool that offers that kind of eval/exec function.
But mostly you can avoid all of that scaffolding with a better toolset.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list