Classes and the command line

Terry Reedy tjreedy at udel.edu
Tue Oct 28 00:08:27 EDT 2014


On 10/26/2014 11:24 PM, Chris Angelico wrote:
> On Mon, Oct 27, 2014 at 2:18 PM, Rustom Mody <rustompmody at gmail.com> wrote:
>> On Monday, October 27, 2014 8:40:48 AM UTC+5:30, Chris Angelico wrote:

>>> You can get block-by-block history by using Idle. I find that fairly
>>> convenient for manipulating class/function definitions.
>>>
>>> ChrisA
>>
>> Umm... Nice!
>> A bit inconsistent in that the '...' does not appear.
>> But thats good; makes copy|cut-pasting from interpreter to file
>> a mostly trivial operation.

One of the differences between console interpreter and Idle Shell is 
that the former is line oriented whereas Shell is statement oriented. 
In the console interpreter, you cannot edit a line after it is entered. 
  In Shell, you can edit any line until you enter an entire statment. 
Similarly, c. i. history recalls a line at a time.  Recalling an 
multiline statment has to be done a line at a time, in order.  Shell 
history recalls an entire statement, even if multiple lines (this is 
what Chris means by 'blocks').  Explaining this difference as the reason 
for no ... is on my todo list.

> It's inconsistent only because the default sys.ps2 is those dots,
> which aren't necessary in Idle. You could make it consistent by simply
> changing sys.ps2.

Nope.  User code is executed in the user process.  Its only effect on 
the Idle process is to write to stdout or stderr for display.  There is 
  tracker issue about letting users change sys.ps1 *in the Idle 
process*, but it would have to be through the menu or config dialog.

-- 
Terry Jan Reedy





More information about the Python-list mailing list