Pierre Barbier de Reuille wrote: > Fuzzyman a écrit : > > > > > > Yes.. but that would mean that eval could only run code objects that > > "consist[s] of a single expression".. which I doubt is the reality or > > the intention. > > > > Regards, > > Fuzzyman > > http://www.voidspace.org.uk/python/index.shtml > > > > [Sorry, I deleted the commented lines because they were completely > unreadable anyway] >
That's alright - I *have* to read via google, which hides quoted lines anyway...... > It's exactly what eval is for : evaluate a single expression and return > its result ! Try with strings : you can't even evaluate a statement ! > You can only evaluate an expression ! > Right. > And what would be the return result of a sequence of statement ? > :-) I'm not interested in the return result. The code object is run in the current namespace, so I use it to run scripts. > If you want to execute a sequence, you want to use exec, not eval ... > Yup - I've swapped them over in my code. Thanks Fuzzyman http://www.voidspace.org.uk/python/index.shtml > Pierre -- http://mail.python.org/mailman/listinfo/python-list