Using something other than ';' to separate statements

Jaime Wyant programmer.py at gmail.com
Wed Mar 30 12:15:53 EST 2005


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 ';'.

Thanks ya'll,
jw

On Wed, 30 Mar 2005 11:58:42 -0500, Peter Hansen <peter at engcorp.com> wrote:
> Jaime Wyant wrote:
> > I know I've seen this somewhere, but can't seem to google it.  Is
> > there a way to use an alternate statement separator, other than the
> > default ';'?
> 
> The validity of Terry's answer (which is true for the general case)
> aside, it might be possible to do what you are trying to do
> if you could explain what it is you are really trying to accomplish,
> rather than just asking about how you think you should accomplish
> it...
> 
> (Ideas involving string.replace and exec come to mind, but
> it's impossible to say whether that might work in your
> context until you provide more background.)
> 
> -Peter
> --
> http://mail.python.org/mailman/listinfo/python-list
>



More information about the Python-list mailing list