multiline prototyping on command line (oops)
Juergen A. Erhard
jae at ilk.de
Sun Oct 31 21:29:37 EST 1999
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi Eric,
>>>>> "Eric" == Eric Smith <eric at fruitcom.com> 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>
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 ilk.de phone: (GERMANY) 0721 27326
My WebHome: http://members.tripod.com/~Juergen_Erhard
GIMP - Image Manipulation Program (http://www.gimp.org)
Codito, ergo sum - "I code, therefore I am" -- raster at redhat.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.0 (GNU/Linux)
Comment: For info see http://www.gnupg.org
iEYEARECAAYFAjgc+w4ACgkQN0B+CS56qs3vLQCeOsMe06m1zn7Bp5p5HUjg1QSq
SFcAn1pRwcKfTgezZqhk2t0PEYLxdeZ8
=GfYl
-----END PGP SIGNATURE-----
More information about the Python-list
mailing list