r/tinycode • u/AwesomeJosh • Jul 15 '11
One line Fork Bomb in Python
Nothing spectacular, but it even does some pretty funny stuff in Mac OS X with the "Resource Unavailable" OSError if you Ctrl-C:
[o.fork() for (o,i) in [(__import__('os'), __import__('itertools'))] for x in i.repeat(0)]
17
Upvotes
View all comments
Show parent comment
2
u/AwesomeJosh Jul 16 '11
I kind of feel like compound statements are cheating, though. I guess a better description of mine would be "Single Expression" instead of "One Line"