Debugging
IceCream is a Python library that makes
debugging easier and more efficient.
With arguments, ic() inspects itself and prints
both arguments and the values.
Just give ic() a variable or
expression and you are done.
from icecream import ic
def sum(x, y):
return x + y
dict = {'a': 1}
ic(sum(2,3))
ic(dict)
Without Arguments
Without argumenst, ic() inspects itself and prints
filename, line number and parent function.
Jupyter doesn't output a new line with the value automatically, if we add a
semicolon.
def myfunction():
ic()
return True
myfunction();
Disable Icecream
We can temporary
disable ic(), and later re-enable.
Icecream
continues to return its arguments when disabled, of course.
ic(1)
ic.disable()
ic(2)
ic.enable()
ic(3);