Debugging 101: Replace print() with icecream ic()
Unlock all features
FREE: Get instant access to 10 AI summaries, chats, or transcripts per day.
Unlock all features
FREE: Get instant access to 10 AI summaries, chats, or transcripts per day.
Unlock all features
FREE: Get instant access to 10 AI summaries, chats, or transcripts per day.
Unlock all features
FREE: Get instant access to 10 AI summaries, chats, or transcripts per day.
Unlock all features
FREE: Get instant access to 10 AI summaries, chats, or transcripts per day.
Related videos
I Replaced 10 Power Tools With My Drill!
Project Farm
277.4k views
Deploy Python Applications - Google Cloud Run with Docker
NeuralNine
40.3k views
What is Hugging Face? - Machine Learning Hub Explained
NeuralNine
78.5k views
Creating APIs For Machine Learning Models with FastAPI
NeuralNine
37.7k views
Automatically Fill Word Files with Python
NeuralNine
38.5k views
Professional Python Testing with Mocks
NeuralNine
88.8k views
Professional Weather App with Django in Python
NeuralNine
52.9k views
Deep Reinforcement Learning with OpenAI Gym in Python
NeuralNine
76.6k views
Live Face Recognition in Python
NeuralNine
216.1k views
Optimize Your Python Programs: Code Profiling with cProfile
NeuralNine
53.5k views
Top Comments (10)
You could do this all much quicker by just inserting the built in python debugger with the line "import pdb; pdb.set_trace()" where you would normally put your print statement. It will then start the debugger in your terminal and you can view and even change all variables during execution. It also helps finding exactly where your code is breaking as you're stepping through the code line by line. I can't recommend it enough.
You know, from 3.10 onward you can essentially do this without packages by doing print(f"{variable=}"). Putting an = after the thing you are formating makes it so that it tells you the name/calculation together with the value.
Learnt something useful today. Thanks, this is something I will probably use in my classes as debugging is what I do 99% of the time.
One of the first things I do in any new language is create a debugging system. Helps to get you confortable with the syntax and environment, and gives you the tools up front to progress more efficiently. This is nice, too.
People will move mountains so they don't have to use the logging package
Only after hearing it a dozen times did I realize that the function ic() is supposed to be a pun "I see" lol
Not going to lie, I use A LOT of print statement to debug. This is very cool , learn something new and will start trying TODAY!
Why the output for result 30 appears/printed before the output for IC? @5:22 [EDITED] I just saw that this happens on every run, the IC output always comes after the program runs. I'm curious to know why.
this is very good bro thanks
Nice improvement for logging. Thanks
Unlock the Data Inside
Turn Videos into Knowledge
- Get FREE 10/day: transcripts, summaries, chats
- Chat with videos, export text & PDF
- $1 free API credit for RAG, chatbots & research
Free forever plan • All features unlocked
Top Comments (10)
You could do this all much quicker by just inserting the built in python debugger with the line "import pdb; pdb.set_trace()" where you would normally put your print statement. It will then start the debugger in your terminal and you can view and even change all variables during execution. It also helps finding exactly where your code is breaking as you're stepping through the code line by line. I can't recommend it enough.
You know, from 3.10 onward you can essentially do this without packages by doing print(f"{variable=}"). Putting an = after the thing you are formating makes it so that it tells you the name/calculation together with the value.
Learnt something useful today. Thanks, this is something I will probably use in my classes as debugging is what I do 99% of the time.
One of the first things I do in any new language is create a debugging system. Helps to get you confortable with the syntax and environment, and gives you the tools up front to progress more efficiently. This is nice, too.
People will move mountains so they don't have to use the logging package
Only after hearing it a dozen times did I realize that the function ic() is supposed to be a pun "I see" lol
Not going to lie, I use A LOT of print statement to debug. This is very cool , learn something new and will start trying TODAY!
Why the output for result 30 appears/printed before the output for IC? @5:22 [EDITED] I just saw that this happens on every run, the IC output always comes after the program runs. I'm curious to know why.
this is very good bro thanks
Nice improvement for logging. Thanks