multiline prototyping on command line (oops)

Juergen A. Erhard jae at
Mon Nov 1 03:29:37 CET 1999

Hash: SHA1

Hi Eric,

>>>>> "Eric" == Eric Smith <eric at> writes:

    >> Anyway, Python's not especially amenable to one-liners.
    >> Instead, it has a really spiffy interactive mode you can leave
    >> running in a window or spare console session that works like
    >> you probably wish `perl -d' worked:

    Eric> Yeah, it is a nice "shell" interface for testing, however
    Eric> one liners are useful:
    Eric> 1. I use their history arrows to access them from the unix shell
    Eric> 2. You can use the unix fc for editing long ones
    Eric> 3. You can paste them into your scripts.
    Eric> 4. They are easy to go back to and edit etc.

I usually either run a python session in an xterm (bad for multiline), or
do python -c '...' multiline.  In zsh  ;-)

Really, try the zsh... I with readline were as good as zsh's ZLE.
Kick-Ass (really) multiline editing.  And a history that correctly
deals with it.

You can also edit here-documents...

    ~ % python <<EOF
    heredoc> class MyTest:
    heredoc>     def __init__(self):
    heredoc>          print "I'm ready"
    heredoc> a = MyTest()
    heredoc> EOF
    I'm ready
    ~ %

Which is much better than -c, because you don't have to worry about
quoting (the snippet above, with the ' inside a ", gets complicated
inside *another* pair of ')

Go back in history, and edit the little snippet... no problem.

Bye, J

PS: Did I mention that zsh is the One True Shell?  ;-)

- -- 
Jürgen A. Erhard      eMail: jae at      phone: (GERMANY) 0721 27326
         My WebHome:
        GIMP - Image Manipulation Program (
    Codito, ergo sum - "I code, therefore I am" -- raster at
Version: GnuPG v1.0.0 (GNU/Linux)
Comment: For info see


More information about the Python-list mailing list