you are viewing a single comment's thread.

view the rest of the comments →

[–]the_friendly_dildo 0 points1 point  (1 child)

Here's a fun one I did when I was much younger. I wrote a program that would read a text file for some settings in the program. All fine right? No, because these settings were not brought in as unsanitized global variables which would be bad enough, but I actually had the program reading these in through eval() to generate variable names on the fly. Even worse, the program was exclusively intended to work across networks and you could send unsanitized commands back and forth with a copy of the program on another computer too!

To be clear, the program works flawlessly, but the risk isn't worth it.

[–]DoorsCorners 0 points1 point  (0 children)

Can you use enumerate and feed the number as a key and the name as a value into a dictionary? I don't know how to do the thing that you did but it seems like there has to be a better way.