IDLE - Customizing output format

James Stroud jstroud at mbi.ucla.edu
Wed Sep 27 06:42:16 CEST 2006


Ilias Lazaridis wrote:
> James Stroud wrote:
>>Ilias Lazaridis wrote:
>>>I am wondering that other users are not annoyed by this reduced
>>>readability.
>>
>>I'm sure its quite unpopular to agree with you, but I do. I am
>>tremendously annoyed the format of the interactive interpreter. Lovely
>>would be output as you describe, but with the option, when selecting for
>>copy-paste, to include the prompts and/or your suggested whitespace
>>margin (e.g. select in doctest mode).
>>
> I am not sure I understand what you meen with the option.
> 
> copy includes both, the ">>>" and the "  :"
> 
> possibly you can elaborate a little, as this could be an important
> factor.

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]


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)]


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.

James

-- 
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095

http://www.jamesstroud.com/



More information about the Python-list mailing list