learning and experimenting python.

Chris Angelico rosuav at gmail.com
Fri Dec 30 15:23:23 EST 2016


On Sat, Dec 31, 2016 at 6:49 AM, Michael Torrie <torriem at gmail.com> wrote:
> Is there a special reason bourne shell uses $ and #?  Coming from an old
> DOS background (>) I found that rather jarring at first.  There's no
> particular reason for any of those shell prompts.  You say "%" is for
> "other shell."  Which shells?  *Any* other shell?  These are all just
> arbitrary.
>
> Furthermore, Python is not a shell, so why would you expect an
> interactive python prompt to look like bourne shell?  Wouldn't that just
> be confusing?
>
> $ python3
> Python 3.4.3 (default, Aug  9 2016, 17:10:39)
> [GCC 4.8.5 20150623 (Red Hat 4.8.5-4)] on linux
> Type "help", "copyright", "credits" or "license" for more information.
> $
>
> No thanks.  I think using > as a prompt character work very well. I
> suppose Python could have made the prompt a bit more like ruby:

Quickly running through the interactive shells and command
interpreters I have available yields this data:

rosuav at sikorsky:~$ bash (my normal terminal prompt)
$ sh, dash
sikorsky% zsh
>>> python, python3, jython
>>>> pypy
> pike, node, threshold, vlc
rosuav=> psql
irb(main):001:0> irb (ruby)
sqlite> sqlite3
(no prompt) php, telnet, bc

And that's not counting the continuation prompts or other-mode prompts
for each of them (eg # for superuser). There are a lot of prompts, but
as you see, ">" is somewhat overused. Without even trying hard, I
found *four* programs that use it unadorned (plus I know bash uses
that as a continuation prompt), yet with the same effort, I found only
*three* with no prompt whatsoever, and they're all in "batch mode" or
similar. (Telnet, for instance, just passes everything on to the
server, so if you're talking to an SMTP server, you get no prompt.) So
there's plenty of good reason to avoid ">", just so people know what's
going on. Can you tell, for instance, what this is?

> 1+2;
3

At least this one has some adornment on its results (since you can
retrieve prior results by index):

> 1+2;
(1) Result: 3

Those are the Node.js and Pike REPLs, respectively. Python has an
advantage because you can instantly see that a transcript comes from
Python. :)

ChrisA


More information about the Python-list mailing list