Skip to content

Instantly share code, notes, and snippets.

@pirsquared
Created May 7, 2019 19:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pirsquared/c7ac03ad107857f01c5c3238fcc9885e to your computer and use it in GitHub Desktop.
Save pirsquared/c7ac03ad107857f01c5c3238fcc9885e to your computer and use it in GitHub Desktop.
# Create an instance of Bomb without crashing the program.
# Monkeypatching __init__ is not allowed.
class Bomb:
def __init__(self):
raise RuntimeError('BOOM')
bomb = Bomb.__new__(Bomb) # YOUR CODE HERE
assert type(bomb) is Bomb, "You didn't create a Bomb instance, did you?"
print('You win!')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment