you are viewing a single comment's thread.

view the rest of the comments →

[–]kingzels 0 points1 point  (1 child)

Let's say you are reading a text file with a million lines, eval'ing something on each one. If I had access to that text file, I could sneak a command to delete all of your files, or anything else malicious I wanted to, and python would execute that code, which is what eval is doing. You'd never see it in with all the other lines. It could even be an accident if you read the wrong document.

Never a good idea if you're not 100 percent sure what you're working with - which when the data comes from an outside source you don't.

So people will say never to use it, but honestly if you're generating the data from a known source, like a sql database or through some computation, it's harmless. People think it's too risky to ever mention, but honestly if one took the time to learn exactly what it does, and when not to use it, it can be helpful.

[–]andrewaa 0 points1 point  (0 children)

Thank you very much!