On Wed, 30 Mar 2005 14:26:20 -0500, Peter Hansen <[EMAIL PROTECTED]> wrote: > Jaime Wyant wrote: > > Well, I'm embedding python in an old C console app. This app uses a > > lot of ; delimited records. > > > > I want to allow the execution of arbitrary python statements inside > > some of these records. I was hoping there was an easy way to set the > > statement terminator. I will simply make up a new terminator and do > > some string substitution to turn my new terminator into python's ';'. > > You refer to it here as a statement terminator, but in > the first posting you called it a statement separator. > I believe it is just a separator, not a terminator, and > as such is not even required unless you need/want to have > two statements on the same line.
Yeah, my thinking was that a separator implied terminator, because to separate something has to have a beginning / ending. Sorry for the inconsistency. Anyway, I did want to be able to string a handful of statements together in one "string". The python statements were one of the semicolon delimited fields I'm working with -- which is where my problem lied. After goofing around with this idea, I've realized you can't be very expressive with a bunch of python statements strung together. My biggest problem is that I can't figure out (i don't think you can), how to do conditionals that are strung together: # This won't work if a > 5: print "a > 5";else print "Doh" I've decided to just call a function from the semicolon delimited record, using the return value in my `C' app... > In all the tens of thousands of lines of Python code > I've written, I don't believe I've ever used a single > semicolon to separate two statements. > > Perhaps you don't need them either... Yeah, I tried to "make it work", but it just won't. At least not in a satisfactory way. Thanks! jw -- http://mail.python.org/mailman/listinfo/python-list