[Edu-sig] interactive vs compiled from file

Andre Roberge andre.roberge at gmail.com
Sat Aug 4 01:59:00 CEST 2007

On 8/3/07, kirby urner <kirby.urner at gmail.com> wrote:
> On 8/3/07, Andre Roberge <andre.roberge at gmail.com> wrote:
> > Kirby got a good point - however, I think that you'd still get the
> "hook"
> > with newbies without the automatic echoing that Michael describes.
> >
> Not sure we should call this "echoing" as what's happening
> is an expression is being evaluated.
> It just so happens that the eval of a quoted string returns
> itself  whereas "some expression with %s" % "substitution"
> would actually evaluate to non-echo.
> kirby at dell:~$ python ./repl.py
> >>> [x*x for x in range(10)]
> [0, 1, 4, 9, 16, 25, 36, 49, 64, 81]
> >>> "1-2-3 %s" % "testing"
> 1-2-3 testing
> Would one turn off all of the above, or just the first eval-print?
> What would be the point of a broken shell, vs explaining that
> Python, like many languages, features a REPL (read-eval-print loop)?
> Kirby
I don't see it as "either or", but as "why not allow both?".    I agree
entirely with the strength of the REPL.  However, when going from that to
having code saved in a file and executed, a huge step occurs (which is what
Michael was referring to I believe) in that to see something output, the
user *must* put in an explicit print statement.

What I envisage right now is to continue to have the default shell using in
Crunchy (prompt = ">>>") and give the possibility to have a "parrot" shell
(obligatory Monty Python reference; he's not dead.  He may not be replying
... but he's just sleeping).   Perhaps the prompt could be

u_)       (parrot lying on its side, two feet up, beak pointing up; sorry
Kirby, the parrot's ribs are too small to see).

I could see a teacher giving a few interactive examples with this shell,
have the students play with it for a short while, and then move on to saving
files and running them.     ... Just something to ease the transition from
the friendly REPL to writing standalone scripts.

@Michael: is this what you had in mind?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/edu-sig/attachments/20070803/8326d5ab/attachment-0001.htm 

More information about the Edu-sig mailing list