Triple quoted string in exec function ?

Rob Williscroft rtw at freenet.co.uk
Tue Dec 30 22:35:28 CET 2008


Stef Mientki wrote in news:mailman.6399.1230668197.3487.python-
list at python.org in comp.lang.python:

>>> And, by the way, exec is a *statement*, not a function!
>>>     
>       exec ( Init_Code, PG.P_Globals )
> 
> I've really doubt that this is a statement,
> unless I don't understand what a statement is.
>>>     
> 

In python 2.x the above is a statement that is passed a tuple:

    	http://docs.python.org/reference/simple_stmts.html#exec

its a statement like print is:

>>> print ( 1,2 )
(1, 2)
>>>

In 3.x it is a function:

    	http://docs.python.org/3.0/library/functions.html#exec

print is also a function in python 3.x, so:

>>> print(1, 2)
1 2
>>>

Rob.
-- 
http://www.victim-prime.dsl.pipex.com/



More information about the Python-list mailing list