Re: eval() in python

2005-06-21 Thread Martin Blume
"Xah Lee" schrieb > > perhaps i'm tired, but why can't i run: > > t='m=3' > print eval(t) > Perhaps you didn't read the documentation? :-) Perhaps you didn't try hard enough? C:\WINNT>c:\programme\python\python Python 2.4 (#60, Nov 30 2004, 11:49:19) [MSC v.1310 32 bit (Intel)] on win32 Type "hel

Re: eval() in python

2005-06-21 Thread Benji York
harold fellermann wrote: > >>> s="print 'hello Xah Lee :-)'" > >>> exec(s) > hello Xah Lee :-) Note that because "exec" is a statement, the parentheses above are superfluous. -- Benji York -- http://mail.python.org/mailman/listinfo/python-list

Re: eval() in python

2005-06-21 Thread Jeff Epler
On Tue, Jun 21, 2005 at 08:13:47AM -0400, Peter Hansen wrote: > Xah Lee wrote: > > the doc seems to suggest that eval is only for expressions... it says > > uses exec for statements, but i don't seem to see a exec function? > > Because it's a statement: http://docs.python.org/ref/exec.html#l2h-563

Re: eval() in python

2005-06-21 Thread Peter Hansen
Xah Lee wrote: > the doc seems to suggest that eval is only for expressions... it says > uses exec for statements, but i don't seem to see a exec function? Because it's a statement: http://docs.python.org/ref/exec.html#l2h-563 -- http://mail.python.org/mailman/listinfo/python-list

Re: eval() in python

2005-06-21 Thread harold fellermann
> the doc seems to suggest that eval is only for expressions... it says > uses exec for statements, but i don't seem to see a exec function? Python 2.4 (#1, Dec 30 2004, 08:00:10) [GCC 3.3 20030304 (Apple Computer, Inc. build 1495)] on darwin Type "help", "copyright", "credits" or "license" for mo