Re: FAQ: How do I calculate what quoted strings and numbers mean?

2006-11-15 Thread p . lavarre
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

Re: FAQ: How do I calculate what quoted strings and numbers mean?

2006-11-15 Thread Fredrik Lundh
[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

Re: FAQ: How do I calculate what quoted strings and numbers mean?

2006-11-12 Thread Fredrik Lundh
[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

FAQ: How do I calculate what quoted strings and numbers mean?

2006-11-10 Thread p . lavarre
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