[Edu-sig] interactive vs compiled from file
Dethe Elza
delza at livingcode.org
Sat Aug 4 05:13:05 CEST 2007
On 3-Aug-07, at 5:35 PM, kirby urner wrote:
> I guess it boils down to a quibble over the verb "echoing" -- a source
> of confusion for me.
I'm not attached to "echoing," that's just what it is called in the
shell (and the shell is not always right). I just wanted to clarify
that we the eval is still happening.
> In the first eval above, the output of the eval looks a lot like
> the input
> (hence "echo").
>
> But most expressions evaluate to a result that's different, so what
> you call "default echoing" I call "default printing of the results of
> evaluation".
Sure, that's fine.
> We're agreeing that what's happening is always an eval, and we're
> agreeing that the print part of REPL could be suppressed, leading
> to REL instead.
;-)
>>>>> sys.displayhook = noecho
>>>>> 'abc'
>>>>> sys.displayhook = echo
>>>>> 'abc'
>> abc
>>>>> _
>> <built-in function displayhook>
>>>>> sys.displayhook = echo_and_assign
>>>>>
>
> This doesn't very newbie-accessible to me.
No. That wouldn't be a first lesson. But maybe for a more
precocious student, to keep them busy while you get the others in the
class get caught up...
>> It's all fun and games, until someone loses their ribs. ;-)
>
> However I think these are *advanced* games.
Agreed. I got carried away playing with it. The point is that
Python has these hooks all over the place, and sometimes when we
think we need to create a new version of the interpreter, all that is
needed is to play with the hooks a bit.
> The original confusion, as I understood it, was "Python in shell mode"
> versus "Python running a .py file". I think we might explain that
> "shell
> mode" is a special script that implements an interactive evaluation
> loop,
> a feature we much appreciate about Python.
>
> Anyway, I'm not here to say "my way or the highway". If you or Andre
> want a "dead parrot mode", why not? Maybe for some students, the
> light
> will go on and all confusions will dissipate -- which I think is
> our shared
> goal.
Absolutely. I think we can agree to agree.
--Dethe
"Any idea that couldn't stand a few decades of neglect is not worth
anything." --Gabriel Garcia Marquez
More information about the Edu-sig
mailing list