| Store | Cart

How to convert string to list without eval or exec

From: Peter Harris <s...@blueyonder.co.uk>
Thu, 11 Mar 2004 22:28:18 +0000
Peter Otten wrote:
> DomF wrote:> > >>>>I'm not allowed to use eval or exec.>>>>>>- write to a file>>>- load the file as module :-)>>>>This made me laugh out loud after reading all the heavy duty parsing>>options, is that bad?> > > It's just like eval and exec in that it allows to execute untrusted code.> > Peter

Would it be safe to use eval but within a namespace with no globals or 
locals? Then the expression could only include literals.

Actually, builtins would be visible too. And you don't want to eval
"[ file('important_file','w') ]" !
But I think there's a way to hide builtins as well, although I forget 
what it is.

Peter Harris

Recent Messages in this Thread
Paul McGuire Mar 09, 2004 09:16 am
Peter Otten Mar 09, 2004 09:54 am
William Park Mar 09, 2004 04:59 pm
DomF Mar 10, 2004 12:02 pm
Peter Otten Mar 10, 2004 12:57 pm
Peter Harris Mar 11, 2004 10:28 pm
Fuzzyman Mar 16, 2004 11:37 am
Messages in this thread