IDLE - Customizing output format

Ilias Lazaridis ilias at lazaridis.com
Wed Sep 27 08:11:13 EDT 2006


James Stroud wrote:
> Ilias Lazaridis wrote:
...
> Well, for example, the output (I'm indenting manually for visual clarity):
>
>       >>> print 'bob'
>         : bob
>       >>> print [i for i in xrange(3)]
>         : [0, 1, 2]
>
>
> Would create the following selection in "doctest" mode (again manually
> adding whitespace):
>
>       >>> print 'bob'
>       bob
>       >>> print [i for i in xrange(3)]
>       [0, 1, 2]

http://docs.python.org/lib/module-doctest.html

ok, I understand now.

then, for consistency reasons, the ":" could become ":::".

doctest would need to get a tiny addition to be able to 'see' those
":::".

> But, say for 'code copy' mode, this selection would be appended to the
> clipboard (again manually adding whitespace for clarity):
>
>       print 'bob'
>       print [i for i in xrange(3)]

I understand.

> This way you could either make doctest blocks or copy code drafted in
> the interactive interpreter. I often get carried away and write complete
> useful functions in the interpreter then have to do commands like the
> following in vim:
>
>       :.,+8s/^....//
>
> to fix ">"s and ellipses, etc., in the copied function. Or if I want to
> tweak a function I'm writing in the interpreter, I painfully copy it one
> line at a time. This may or may not be the best way to use the
> interpreter (to draft actual code) but I find myself doing it all of the
> time.

I am wondering that this functionality (copy code) is not included
within IDLE.

It should be possible to add it quite simple.

.




More information about the Python-list mailing list