Aspiring Data Science
370 subscribers
425 photos
11 videos
10 files
1.87K links
Заметки экономиста о программировании, прогнозировании и принятии решений, научном методе познания.
Контакт: @fingoldo

I call myself a data scientist because I know just enough math, economics & programming to be dangerous.
Download Telegram
#python #debugging #ic #icecream

from icecream import ic

# Using ic() to debug
ic(add(10, 20))
ic(add(30, 40))


ic| add(10, 20): 30
ic| add(30, 40): 70


ic.disable()  # Disables ic()
ic(multiply(3, 3)) # Prints nothing

ic.enable() # Re-enables ic()
ic(multiply(3, 3)) # Output: ic| multiply(3, 3): 9


def log_to_file(text):
with open("debug.log", "a") as f:
f.write(text + "\n")

ic.configureOutput(prefix="DEBUG| ", outputFunction=log_to_file)

ic(multiply(7, 7))


https://medium.com/pythoneers/debugging-in-python-replace-print-with-ic-and-do-it-like-a-pro-18f330c863cb
1