Re: Make the "python" command resemble the standard Python interpreter

Khoo Yit Phang
2012-01-30T03:11:16Z

Hi,

On Jan 26, 2012, at 12:43 PM, Doug Evans wrote:

> On Tue, Jan 24, 2012 at 9:30 AM, Tom Tromey <tromey@redhat.com> wrote:
>>>>>>> "Doug" == Doug Evans <dje@google.com> writes:
>>
>> Doug> I'm not that comfortable with having the python command having such
>> Doug> varying behaviours (especially based on the value of from_tty).
>>
>> What bad effect do you think it will cause?
>
> [for example]
> Suppose I want to cut-n-paste some lines from a script into my session?
> Maybe as a quick hack or maybe to test something out or whatever.
>
> With this change I can't do that for something that contains:
>
> python
> foo
> end

This scenario works perfectly fine in my current implementation based on from_tty: "python\n" starts the Python REPL, "foo\n" runs in the interpreter, and "end\n" quits the interpreter ("end" by itself in a line is specially recognized as an alternative to Ctrl-D), which has the same outcome as in the script.

Yit
January 29, 2012