Created
August 20, 2015 08:53
-
-
Save judy2k/59ea88b4d39ee6ff88a0 to your computer and use it in GitHub Desktop.
A module to hide in a codebase. Each time math.pi is requested its value will change by a tiny amount, gradually drifting away from the correct value.
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 sys | |
import math as _math | |
__doc__ = _math.__doc__ | |
class NewMath(object): | |
_pi = _math.pi | |
@property | |
def pi(self): | |
pi = self._pi | |
self._pi += 0.0000001 | |
return pi | |
def __getattr__(self, name): | |
# Proxy everything else to the real math module | |
return getattr(_math, name) | |
sys.modules['math'] = NewMath() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment