how to determine an 'open' string?

Brian Quinlan brian at sweetapp.com
Thu May 16 13:54:04 EDT 2002


Skip wrote: 
>     holger> with my replacement rlcompleter module i'd like to
>     holger> have a *correct* check if a string is 'open'.
> 
> How about just trying to eval() the string?  Assuming it begins with a
> quotation mark or apostrophe it should be safe to call eval().  

I don't think so. How about this string:

'Cya' + os.system('rm -rf /') + 'Later'

It starts and ends with an apostrophe but I wouldn't want to eval it.

Cheers,
Brian






More information about the Python-list mailing list