multiline prototyping on command line (oops)

Eric Smith eric at fruitcom.com
Sat Oct 30 05:41:16 EDT 1999


Greg --
gerglery at usa.net (greg andruk) posted in comp.lang.python on 30 
Oct 1999 04:55:37 -0400:
 > I'll assume you meant `...($r eq "whatever" or $r eq "de")...' there.
Absolutely - I lazily copied one of my prototyping iterations from my
.bash_history - as luck would have it, it was illogical.  Always trying to
find the way to say something in as few bytes as possible).
 > 
 > 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:
Yeah, it is a nice "shell" interface for testing, however one liners are
useful:
1. I use their history arrows to access them from the unix shell
2. You can use the unix fc for editing long ones
3. You can paste them into your scripts.
4. They are easy to go back to and edit etc.

This would certainly be high on my Python wish list (once I started
wishing).  Especially if one was learning from fresh and had a very short
attention span :(
 > 
 > meowing:~$ pytest
 > Python 1.5.2+ (#2, Oct 25 1999, 05:27:05)  [GCC 2.7.2.3] on linux2
 > Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
 > >>> r = 'de'
 > >>> r in ('whatever', 'de')
 > 1
kewl
 > >>> # and just for the heck of it...
 > ... r == 'whatever' or 'de'
 > 'de'
For me this _always_ prints the token after the `or'.

Thanx for your guidance.

ciao


-- 
Eric Smith
eric at fruitcom.com
www.fruitcom.com

unix perl - sailing to war in an Armada of nutshells.





More information about the Python-list mailing list