import mysteries

David Abrahams dave at boost-consulting.com
Tue Jul 3 18:47:24 EDT 2007


on Fri Jun 22 2007, "Steven D'Aprano" <steven-AT-REMOVE.THIS.cybersource.com.au> wrote:

> There are ways to bypass the import system. The most obvious would be to 
> write directly to globals.
>
>>>> spanish_inquisition
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
> NameError: name 'spanish_inquisition' is not defined
>>>> globals()['spanish_inquisition'] = "NOBODY expects the Spanish 
> Inquisition!!!"
>>>> spanish_inquisition
> 'NOBODY expects the Spanish Inquisition!!!'

Yeah, of course.  I just don't think anything that perverse is
happening in these cases.  Take, for another example,
http://trac.edgewall.org/ticket/5646#comment:3

-- 
Dave Abrahams
Boost Consulting
http://www.boost-consulting.com

The Astoria Seminar ==> http://www.astoriaseminar.com




More information about the Python-list mailing list