exec '' in {} what does this do?

Erik Max Francis max at alcyone.com
Tue Nov 5 17:46:31 EST 2002


Lee Harr wrote:

> I thought "in" checked to see if a key was in the dict,
> I do not understand why this inserts anything in to the dict.

exec S in D simply executes the statement S with the dictionary D as its
globals.

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/  \ After a thousand years or so you go native.
\__/ Camden Benares
    PyUID / http://www.alcyone.com/pyos/uid/
 A module for generating "unique" IDs in Python.



More information about the Python-list mailing list