Last active
December 29, 2017 06:50
-
-
Save cyingfan/06ad98e14596ab91ff8bde6d5f32dfe8 to your computer and use it in GitHub Desktop.
Deep Thought Simulator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class DeepThoughtSimulator | |
{ | |
public function getAnswerToTheUltimateQuestionOfLifeTheUniverseAndEverything() | |
{ | |
sleep(7500000 * 365.24219 * 24 * 60 * 60); | |
return 42; | |
} | |
public function __call($name, $arguments) | |
{ | |
return $this->getAnswerToTheUltimateQuestionOfLifeTheUniverseAndEverything(); | |
} | |
public function __get($name) | |
{ | |
return $this->getAnswerToTheUltimateQuestionOfLifeTheUniverseAndEverything(); | |
} | |
public function __invoke() | |
{ | |
return $this->getAnswerToTheUltimateQuestionOfLifeTheUniverseAndEverything(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
class DeepThoughtSimulator(object): | |
def getAnswerToTheUltimateQuestionOfLifeTheUniverseAndEverything(self): | |
try: | |
time.sleep(7500000 * 365.24219 * 24 * 60 * 60) | |
except KeyboardInterrupt: | |
print("Okay, it doesn't have to take so long") | |
return 42 | |
def __getattr__(self, name): | |
return self.getAnswerToTheUltimateQuestionOfLifeTheUniverseAndEverything() | |
def __call__(self, *args, **kwargs): | |
return self.getAnswerToTheUltimateQuestionOfLifeTheUniverseAndEverything() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment