From: Doug Evans <dje@google.com>
To: Khoo Yit Phang <khooyp@cs.umd.edu>
Cc: Tom Tromey <tromey@redhat.com>,
Paul_Koning@dell.com, gdb-patches@sourceware.org
Subject: Re: Make the "python" command resemble the standard Python interpreter
Date: Mon, 30 Jan 2012 17:25:00 -0000 [thread overview]
Message-ID: <CADPb22RzB765fDbNLeJ392eVSfnbgS4eSw1uP3q54q4yv+kkRQ@mail.gmail.com> (raw)
In-Reply-To: <E4F090B1-72AE-4891-BF56-56C46028422F@cs.umd.edu>
On Sun, Jan 29, 2012 at 7:10 PM, Khoo Yit Phang <khooyp@cs.umd.edu> wrote:
> 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.
Assuming the script didn't intentionally force some keyboard interaction.
[In emacs I sometimes just cut-n-paste a part of a script en masse.]
Plus, with some playing around I found this:
--- foo.gdb - snip ---
python
if 0 == 1:
print "foo"
print "bar"
end
--- snip ---
(gdb) source foo.gdb
bar
(gdb)
But cut-n-paste that script into gdb and I get this:
(gdb) python
if 0 == 1:
print "foo"
print "bar"
end
>>> ... ... File "<stdin>", line 3
print "bar"
^
SyntaxError: invalid syntax
>>>
(gdb)
[For reference sake, here's how I cut-n-pasted it in emacs:
C-x C-f foo.gdb RET C-space C-x ] C-b M-w C-x b RET C-y RET
I hope I transcribed that right.]
Python's repl expects a blank line to end the block.
I don't know if there's a way to work around this. Maybe there is.
So now I'm even less comfortable.
next prev parent reply other threads:[~2012-01-30 17:19 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-11 0:31 Khoo Yit Phang
2012-01-11 4:06 ` Joel Brobecker
2012-01-11 10:43 ` Kevin Pouget
2012-01-11 10:59 ` Joel Brobecker
2012-01-11 16:04 ` Khoo Yit Phang
2012-01-11 17:48 ` Khoo Yit Phang
2012-01-11 18:48 ` Kevin Pouget
2012-01-11 19:04 ` Khoo Yit Phang
2012-01-11 19:11 ` Kevin Pouget
2012-01-11 21:06 ` Khoo Yit Phang
2012-01-11 21:33 ` Tom Tromey
2012-01-11 22:22 ` Khoo Yit Phang
2012-01-20 21:25 ` Tom Tromey
2012-01-20 21:31 ` Tom Tromey
2012-01-22 16:42 ` Khoo Yit Phang
2012-01-11 20:56 ` Tom Tromey
2012-01-11 21:30 ` Khoo Yit Phang
2012-01-11 21:41 ` Tom Tromey
2012-01-12 3:07 ` Khoo Yit Phang
2012-01-13 14:09 ` Phil Muldoon
2012-01-13 21:39 ` Khoo Yit Phang
2012-01-12 16:48 ` Doug Evans
2012-01-12 16:52 ` Khoo Yit Phang
2012-01-12 16:55 ` Paul_Koning
2012-01-12 17:24 ` Joel Brobecker
2012-01-12 17:30 ` Doug Evans
2012-01-12 17:38 ` Paul_Koning
2012-01-12 17:46 ` Doug Evans
2012-01-12 17:48 ` Doug Evans
2012-01-12 17:51 ` Paul_Koning
2012-01-12 18:06 ` Doug Evans
[not found] ` <CADPb22T1ZmfiGeF9g-QZN6pCTBHwT5ByD9ddX_Dhxe4URvTAhw@mail.gmail.com>
2012-01-12 18:21 ` Khoo Yit Phang
2012-01-12 18:36 ` Doug Evans
2012-01-12 18:48 ` Khoo Yit Phang
2012-01-12 21:22 ` Doug Evans
2012-01-12 18:30 ` Doug Evans
2012-01-21 1:56 ` Tom Tromey
2012-01-22 16:57 ` Khoo Yit Phang
2012-01-23 22:17 ` Doug Evans
2012-01-24 17:36 ` Tom Tromey
2012-01-26 18:28 ` Doug Evans
2012-01-30 6:50 ` Khoo Yit Phang
2012-01-30 17:25 ` Doug Evans [this message]
2012-01-30 19:57 ` Doug Evans
2012-02-06 20:08 ` Doug Evans
2012-02-06 20:13 ` Paul_Koning
2012-02-06 20:30 ` Khoo Yit Phang
2012-02-06 20:34 ` Doug Evans
2012-02-06 20:59 ` Paul_Koning
2012-02-06 21:54 ` Tom Tromey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CADPb22RzB765fDbNLeJ392eVSfnbgS4eSw1uP3q54q4yv+kkRQ@mail.gmail.com \
--to=dje@google.com \
--cc=Paul_Koning@dell.com \
--cc=gdb-patches@sourceware.org \
--cc=khooyp@cs.umd.edu \
--cc=tromey@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox