how to iterate over sequence and non-sequence ?

Duncan Booth duncan.booth at invalid.invalid
Fri Oct 19 14:34:12 CEST 2007

Nils <nils.lastein at> wrote:

> why not:
>>>> for i in eval('(1,2,3)'):
> ...     print i
> 1
> 2
> 3

For the exact same reason Steven already gave you: one day someone will 
give you bad data.

For eval you need to use slightly more complicated expressions. e.g. 
"__import__('os').system('rm # -rf /')"
will be sufficient to mess you up.

More information about the Python-list mailing list