A FAQ that discusses good ways to handle Python-like literals and
expressions would definitely be a useful addition to the FAQ. if nobody
else does anything about it, I'll get there sooner or later.
Thank you.
eval(source, {'builtins': {}}) works enough like an evaluator of
literals to
[EMAIL PROTECTED] wrote:
I was happy enough when I saw an improvement like:
import os
result = eval(os.system('pwd'))
.../Desktop
result = eval(os.system('pwd'), {whatever: {}})
Traceback (most recent call last):
File stdin, line 1, in module
File string, line 1, in module
[EMAIL PROTECTED] wrote:
But those objections miss the point. Having had those troubles
explained to me now, I'm still leaving my code unchanged - it still
does what I mean. That is,
eval(source, {'builtins': {}}) works enough like an evaluator of
literals to let you duck the work of
Subject: announce: FAQs suggested ...
http://effbot.org/pyfaq/suggest.htm has new FAQ's ...
FAQ: How do I calculate what quoted strings and numbers mean?
A: eval(source, {'builtins': {}}) works, without also accidentally
accepting OS commands as input.
Note: Eval might surprise you if you