List comprehension - NameError: name '_[1]' is not defined ?

ajaksu ajaksu at
Fri Jan 16 02:30:25 CET 2009

On Jan 15, 8:21 pm, mario ruggier <mario.rugg... at> wrote:
> OK! Here's a small script to make it easier...

Thanks! I think I found a quick way around the restrictions (correct
me if I borked it), but I think you can block this example by
resetting your globals/builtins:

exprs = [
    '(x for x in range(1)).gi_frame.f_globals.clear()',
    'open("where_is_ma_beer.txt", "w").write("Thanks for the fun  ")'


More information about the Python-list mailing list