string issue or questions about intern

Paul Prescod paul at prescod.net
Fri Jul 14 17:37:04 EDT 2000


Andrew Kuchling wrote:
> 
> ...
> 
> If you need full Python expressions, there seems no way around using
> eval().  But if you simply need string escapes, it's probably worth
> writing a parser.  (Does such a parser already exist somewhere in the
> standard library?  Anyone know?)

In general, wouldn't it be nice if there was a parser for all Python
literal syntaxes? Sometimes its really convenient to keep your data in a
format like this:

{"a":"b"}

but I cringe to load the file and then eval it for security reasons.

-- 
 Paul Prescod - Not encumbered by corporate consensus
It's difficult to extract sense from strings, but they're the only
communication coin we can count on. 
	- http://www.cs.yale.edu/~perlis-alan/quotes.html





More information about the Python-list mailing list