Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

If anyone's interested, the likelihood of a string with a length between 100 and 1000 characters which contains characters randomly selected from digits, lowercase letters, spaces and the following characters: \n,[](){}'."=+-*/%: is valid python is something like 0.015% (determined empirically)


That seems like quite a lot for 100 characters. I'm guessing they are mostly numbers?

EDIT: wait, you actually ran code produced from this?


I just ran the part that generates a function with a random string as the body and called the function that it generated, and counted the calls that didn't throw anything. As I threw it together in all of 5 minutes I'm sure there are flaws in the methodology

Also the defuckify code I posted is not exactly right, as it was sort of a joke but it's pretty easy to fix




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: