[Tutor] Changing the Attribute of a Variable

Alan Gauld alan.gauld at btinternet.com
Thu Feb 19 01:34:55 CET 2009


"Wayne Watson" <sierra_mtnview at sbcglobal.net> wrote

>  Maybe the web documents should warn about the horrors of eval. 
> VBG. Possibly the same is true of exec?

Yes the same is true of exec and also potentially execfile.
All need to be used with extreme care where there is any 
risk of the executed code being tampered with outside 
the program.

Thats why we have been saying that setattr/getattr etc 
are better ways of doing things.

HTH,


-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/l



More information about the Tutor mailing list