srtring to int question

Darrell Gallion darrell at dorb.com
Sun Aug 13 17:25:51 EDT 2000


From: "Bernhard Herzog" <herzog at online.de>
> > 
> > import re, sys
> > globalNames={'hex':__builtins__.hex, 'int':__builtins__.int,
> > 'raw_input':__builtins__.raw_input}
> 
> Putting these into globalNames is not really necessary because exec and
> eval will add the __builtin__ module to the dict passed in as the
> globals dict anyway, unless there is already a __builtins__ entry in the
> dict. That's how resticted execution works, btw, by having a custom
> __builtins__ dictionary in the globals dict.
> 

Now that was surprising. 
--Darrell







More information about the Python-list mailing list