Immediately autoreload modules if they are changed outside
1
2
3
4
5
6
7
8
9
10
11
%matplotlibinlineplt.rcParams['figure.figsize']=(5.0,4.0)# set default size of plots
plt.rcParams['image.interpolation']='nearest'plt.rcParams['image.cmap']='gray'# load the autoreload extension
%load_extautoreload# autoreload mode 2, which loads imported modules again
# everytime they are changed before code execution.
# So we don't need to restart the kernel upon changes to modules
%autoreload2
%timeit: runs the command under test multiple loops, each loop multiple times to get the Gaussian statistics of its speed.
1
2
3
4
fromloggingimportgetLoggerlogger=getLogger("Logger")# see 574 μs ± 55.2 μs per loop (mean ± std. dev. of 7 runs, 1,000 loops each)
%timeitlogger.warn("hello_world")