Convert obejct string repr to actual object

Steven D'Aprano steve at REMOVE-THIS-cybersource.com.au
Tue Oct 9 00:47:23 CEST 2007


On Mon, 08 Oct 2007 21:19:50 +0200, Tor Erik Sønvisen
wrote:

> I don't want to use eval, since I can't trust the source sending the
> object.... I'm sure someone must have had the same need and created code
> for it... Maybe Pypy has what I need??? Haven't looked though...


For the benefit of those who think they can make eval "safe", start here:

http://effbot.org/zone/librarybook-core-eval.htm


Here's a good solution:

http://effbot.org/zone/simple-iterator-parser.htm



-- 
Steven.



More information about the Python-list mailing list