Warning: your Python intepreter is now drunk, every number it sees are noisy...
Use 'setrwatch({})' to disable it.
In [2]: 0
Out[2]: 10.7445342051449549
In [3]: 1
Out[3]: -0.35048804156890245
In [4]: 1 / 0
Out[4]: -2.546899181270205
# Install it from https://github.com/dutc/rwatchimportrwatchfromsysimportsetrwatch,getrwatchsetrwatch({})# clean any previously installed rwatchimportnumpyasnpfromcollectionsimportdefaultdictfrominspectimportgetframeinfofromnumbersimportNumberdefadd_white_noise_to_every_numbers(frame,obj):ifisinstance(obj,Number):info=getframeinfo(frame)if'<stdin>'ininfo.filenameor'<ipython-'ininfo.filename:returnobj+np.random.normal()returnobjprint("Warning: your Python intepreter is now drunk, every number it sees are noisy...")print("Use 'setrwatch({})' to disable it.")setrwatch(defaultdict(lambda:add_white_noise_to_every_numbers))# That's it, your interpreter is now drunk!
HTTPSSSH
You can clone a snippet to your computer for local editing.
Learn more.