Would be helpful if you can make your videos more concise. You don't need a 10min long video to say use ic instead of print. Too much fluff is usually not helpful in the long run.
first problem you can use f-strings if you don't wanna add unnecessary modules a, b, c = 3, 5, 75 print(f"{a=} {b=} {c=}") # output: a=3 b=5 c=75 Adding an equal after variable name will also print the variable name along with the value
You're right! I covered this tactic in my f-strings video already, if you don't want unnecessary modules then sure. ice cream is still less typing than f-strings though and the added ability to disable it which we can't do with print
@@codewithjoshoffical honestly if someone wants to turn off, they should use the logger module built into python, has more features. Can do the same things with extra features.
One should use neither print, nor icecream. Pythons built-in logging module is the defacto way too go here, with different log levels, ability to pipe to different outputs. Combine that with f-strings and you got everything you need.
Yup, True! I find ice cream to be a fun module but on a larger scale logging is far superior. I've been listening to you guys in the comments and I've got a logging episode in the works now 😁
I see 3 major use cases for print: 1) you are learning python and you literally print out all the answeres to your programming excercises 2) you are writing a comand line tool 3) for debugging Print is fine to all those use-cases. Only in case of 3) you should switch to proper logging at some point In any case I don't really see the point of icecream. It does a slightly better job (at best) for the cost of another third-party library .... meh
You’re right, while it’s fun and all I think the best use case is #1 as you said, working on programming exercises. Maybe a little debugging but logging still has it beat
I don't know why print doesn't give you the information you need. It always gives me the information I need. So, no thanks to an extra module. Btw, speaking of redundant, you repeat yourself too much.
The print function should be used for user output, not for debugging. icecream is better as a debugging tool but break-points as looking at variables should be better.
You’re right, print statements are more for user output while learning code but in real world applications we aren't using print for our own sake more for lazy debugging 😆. That is why I think Ice Cream is pretty cool, print on a new level.
@@codewithjoshoffical I wrote an iprint function that uses f-strings and print, which I can disable. The advantage of my own function is that I can customize my output using regional formats and various colors with colorama. I can also create horizontal separators (lines) with the terminal's width automatically. With icecream, I am limited to what the author provides. They choose the color, format, indentation, etc. In general, I prefer creating my own solutions using the basics.
@@codewithjoshoffical you could disable print on top of your function (or file) replacing it with an empty lambda function like this: print = lambda *args, **kwargs: None combine this with f string printing for labels like print(f'{x=}') and you get basically the same functionality and workflow with only builtin python modules
Thank you for making this video and sharing it with all of us. Some constructive feedback: In production, we would not prefer to use ice cream or any other third-party module. Use the python logger and set logging levels and format. Then you can have a standard and you can toggle things on and off by setting the logging level to debug or set the logging level to whatever you desire while you’re programming and turn off debug mode when you go into production. I did like the fact that ice cream automatically informed on which variable was being printed. Maybe a combination of using ice cream and the python logging module would make an even nicer solution? I will give it some thought. Either way, I gave this video a thumbs up, and I subscribed for more!
Thanks for your comment! Also you are so right, I find ice cream to be a fun module but on a larger scale it can't compete with logging. I've got a logging episode in the works now! Anyways, have a great day 😁
So, use an abstraction, like icecream , which uses other abstractions, like pprint + others, who are just abstractions over the print function, which itself is an abstraction on top of C?
Thanks, yeah can be done with f-stings which I covered in a past video. This is just a helpful module and the fact that it can quickly be disabled is a huge plus 😄
Interesting module, reminds me of C macros used for debugging. For python I usually use pdb and logging for debugging. Will try out ic to see what difference it makes. Thanks for the video.
@@codewithjoshoffical actually, a tutorial on pdb could be quite useful for beginning python students. Students learning C learn about debugger (like GDB) and linters fairly early, but from my experience, python students don't get to see pdb, logging, pytest, and pylint until much later in their learning cycle.
If your console is flooded with debugging output, I think you are doing something wrong. If I use print for debugging, I add very few lines. Ant typically remove them as soon as the problem is found, as I don't want to have thau now useless output disturb me while debugging another problem. If the output may be useful for debugging later on, the right way to do it is through logging. And no, I won't stop using print because my programs often print as part of their normal operation.
ic is nice, but is yet another dependency, and something that needs to be installed. You are guaranteed that print() is available. And of course print gives you much more control over what is actually printed.
Im probably the biggest n00b out here but that is very useful. I shouldn't learn myself bad habits but once learned i can imagine this being useful. Lemme continue on my text adventure game using print now.... 😁😅😊
Ok, so use a library to replace the print statement. The library extracts the name of the variable, and prints the value of the variable .. using a print statement.
Great. Now I'm going to gain a lot of weight. Every time I type and ice cream statement I'm going to start craving ice cream. Why couldn't it be called "vomit?"
Does Python not have a debugger or what? If your programming language doesn't have a debugger, you can use print() (or something similar) to debug. Of course, in all other cases you should use the debugger. You debug and your code remains untouched. There's nothing to think about.^^ However, for longer periods of time it makes sense to also use unit tests. They are not really suitable for debugging, but are very useful for finding hidden errors during further development. By the way, I really don't like Python. In my opinion it is only suitable for mathematically compliant calculating and plotting. ^^ I learned to program using Java, a mature programming language, but my favorite language is probably C/C++. Incredibly efficient and if you really want to master programming, C is a must. You will learn so much more about what programming really is and about the PC and how it works.
Would be nice to see some benchmarks. I'd also shy away from saying never do this or always use this. Different scenarios call for different tools. Two minutes in before you got to the content.
@@codewithjoshoffical ah you should have started this video with a statement like, "hold on to your pitchforks people, bear with me this does more than f-string" most persons will likely ignore and not watch the whole video cause you are basically telling them to use a library for something f string does. Anyway this is not on you but the name of the library couldn't be worse for its use, ice cream?
If you don't want to go through and change all of those "print" statements to "ic" you can reassign print to be ic during the import. ```from icecream import ic as print```
👉 Join my Python Newsletter ~ www.thenerdnook.io
👉Join our Discord Community ~ discord.gg/dvrcpXSwyc
👉Get my Python Courses, Free ~ zerotoknowing.gumroad.com
Would be helpful if you can make your videos more concise. You don't need a 10min long video to say use ic instead of print. Too much fluff is usually not helpful in the long run.
I'm gonna use print twice as much now.
He did mention to use IC around 1 min. That’s not very long I would say.
But then he wouldn't make much from ad revenue 🤷
10 minute videos with 30 seconds of value are all about satisfying The Algorithm.
I'm a novice programmer, so I'm happy for someone to take 10minutes to go through the build
first problem you can use f-strings if you don't wanna add unnecessary modules
a, b, c = 3, 5, 75
print(f"{a=} {b=} {c=}")
# output: a=3 b=5 c=75
Adding an equal after variable name will also print the variable name along with the value
You're right! I covered this tactic in my f-strings video already, if you don't want unnecessary modules then sure.
ice cream is still less typing than f-strings though and the added ability to disable it which we can't do with print
@@codewithjoshoffical honestly if someone wants to turn off, they should use the logger module built into python, has more features.
Can do the same things with extra features.
@@codewithjoshoffical this is 101 python how u dont know that xD
Print is redundant. Replaces print with redundant code. Print is slow. Imports a module.
One should use neither print, nor icecream. Pythons built-in logging module is the defacto way too go here, with different log levels, ability to pipe to different outputs. Combine that with f-strings and you got everything you need.
Yup, True! I find ice cream to be a fun module but on a larger scale logging is far superior. I've been listening to you guys in the comments and I've got a logging episode in the works now 😁
I see 3 major use cases for print:
1) you are learning python and you literally print out all the answeres to your programming excercises
2) you are writing a comand line tool
3) for debugging
Print is fine to all those use-cases. Only in case of 3) you should switch to proper logging at some point
In any case I don't really see the point of icecream. It does a slightly better job (at best) for the cost of another third-party library .... meh
You’re right, while it’s fun and all I think the best use case is #1 as you said, working on programming exercises. Maybe a little debugging but logging still has it beat
I was highly skeptical when you said never use print again, but then my mind was blown when you showed me the ice cream!
Haha 😆. I’m glad you liked it!
I don't know why print doesn't give you the information you need. It always gives me the information I need. So, no thanks to an extra module. Btw, speaking of redundant, you repeat yourself too much.
The print function should be used for user output, not for debugging. icecream is better as a debugging tool but break-points as looking at variables should be better.
You’re right, print statements are more for user output while learning code but in real world applications we aren't using print for our own sake more for lazy debugging 😆. That is why I think Ice Cream is pretty cool, print on a new level.
Great vid I'm absolutely going to use this from now on. Thanks buddy
Thanks, Glad it was helpful 👍
Love your content Josh! Big thank you!
Absolutely, thanks for being here! I’m glad you like it 😁
Great tip. Long time SW Eng here, but fairly new to Python. This is definitely a better approach than print()!
Thanks! Definitely a fun module, for larger scale projects logging module is probably better
You can do this with f strings, no need to import another library.
Yup you’re right too, I covered that in an f-strings video too!
Perk of this is you can disable it without have to delete it all 😁
@@codewithjoshoffical I wrote an iprint function that uses f-strings and print, which I can disable. The advantage of my own function is that I can customize my output using regional formats and various colors with colorama. I can also create horizontal separators (lines) with the terminal's width automatically. With icecream, I am limited to what the author provides. They choose the color, format, indentation, etc. In general, I prefer creating my own solutions using the basics.
@@codewithjoshoffical you could disable print on top of your function (or file) replacing it with an empty lambda function like this:
print = lambda *args, **kwargs: None
combine this with f string printing for labels like print(f'{x=}') and you get basically the same functionality and workflow with only builtin python modules
@@ClemensHolleis This is interesting! Thanks for sharing
Thank you for making this video and sharing it with all of us.
Some constructive feedback:
In production, we would not prefer to use ice cream or any other third-party module.
Use the python logger and set logging levels and format.
Then you can have a standard and you can toggle things on and off by setting the logging level to debug or set the logging level to whatever you desire while you’re programming and turn off debug mode when you go into production.
I did like the fact that ice cream automatically informed on which variable was being printed.
Maybe a combination of using ice cream and the python logging module would make an even nicer solution?
I will give it some thought.
Either way, I gave this video a thumbs up, and I subscribed for more!
Thanks for your comment! Also you are so right, I find ice cream to be a fun module but on a larger scale it can't compete with logging. I've got a logging episode in the works now! Anyways, have a great day 😁
So, use an abstraction, like icecream , which uses other abstractions, like pprint + others, who are just abstractions over the print function, which itself is an abstraction on top of C?
F Strings cover most of this functionality. When I saw "So using print" I assumed the video was going to be about logging.
Keep putting out videos.
Thanks, yeah can be done with f-stings which I covered in a past video.
This is just a helpful module and the fact that it can quickly be disabled is a huge plus 😄
Whoa whoa WHOA! What dark wizardry is this at 7:20? Please explain how you did that.
I’m on a Mac, when you hold command you can click to multiple places at once 😁
you can do this on vs code. just select the word and right click and edit all occurrences .
Interesting module, reminds me of C macros used for debugging. For python I usually use pdb and logging for debugging. Will try out ic to see what difference it makes. Thanks for the video.
There’s so many modules I lose count 😂
@@codewithjoshoffical actually, a tutorial on pdb could be quite useful for beginning python students. Students learning C learn about debugger (like GDB) and linters fairly early, but from my experience, python students don't get to see pdb, logging, pytest, and pylint until much later in their learning cycle.
Thanks Josh I was looking for this 😂❤
Looking for ice cream? Me too! 😆
Wow that is interesting, thanks for sharing. What kind of environment you are using for this module
Haha, nice one! love your humor as always!
Thanks! Go try it out, let me know your thoughts 😁
Cool tool. Thank you for sharing such wonderful tips
Thank you! I hope you can have some fun with this one 😁
IC is much better than print ()
Thanks 👍
Glad you think so too!
Oh come on, debugging the the fun part 🙃
ic does save the formatting of the print stmts with the auto labels - good to know.
Haha 😂. Debugging turns my hair gray lol
What is perfomance IC vs Print ???
very slow
Thanks Man you are awesome
Thanks!
Can you make discurd channel to learn pyton together
Something I've been considering!
Thank you. Helpful hint to pynoobs.
Glad it was helpful!
ok I'm not using print:
import sys
sys.stdout.write("Hello world!")
Perfect.
Thank you
Glad it was helpful! 😁
I hears somewhere that the RUclips algorithms are friendlier to the poster if fluff is added.
If your console is flooded with debugging output, I think you are doing something wrong. If I use print for debugging, I add very few lines. Ant typically remove them as soon as the problem is found, as I don't want to have thau now useless output disturb me while debugging another problem.
If the output may be useful for debugging later on, the right way to do it is through logging.
And no, I won't stop using print because my programs often print as part of their normal operation.
"Dont use print it is slow!" Instead "use print with additional serialize to stringr" 😂
🎉excellent, thank you so much
Absolutely 😁
Really cool. Thanks.
Glad you liked it, go try it out! 😁
So where do I get the icecream module? You said a bunch of stuff about how good ic is and didn’t mention how to obtain it…
pip install icecream
Python Debug Log: All of that just for a bit of a log
if you like icecream, rich will mos def blow your mind
Yeah. Rich is a cool module too!
ic is nice, but is yet another dependency, and something that needs to be installed. You are guaranteed that print() is available. And of course print gives you much more control over what is actually printed.
Very true!
Logging is the best
Yeah, I’ll try to get a logging episode sometime here for you all
this is good!
Thanks! Hope it helps 😁
When you printed the data it looked like the data was reversed ?
thank you!
Hope you have some ice cream now 🍦
Im probably the biggest n00b out here but that is very useful. I shouldn't learn myself bad habits but once learned i can imagine this being useful. Lemme continue on my text adventure game using print now.... 😁😅😊
Baby steps lead to a stronger foundation 💪
Ok, so use a library to replace the print statement. The library extracts the name of the variable, and prints the value of the variable .. using a print statement.
Sounds like the EVALUATE statement from COBOL
import icecream as print :) haha
Haha, yes even better!
Pls can you do a video in Dart programming language.
Thx.😁😁😁
You bet!
Great. Now I'm going to gain a lot of weight. Every time I type and ice cream statement I'm going to start craving ice cream. Why couldn't it be called "vomit?"
Hahaha, could you imagine... the vomit module 😆
Chouette! Merci
4 minutes long is more than enough for this video.
just use the damn debug
Sherbert?
Gelato?
What r u out of your mind , why would I do that, print is simpler and without any 3rd party dependency.
Does Python not have a debugger or what?
If your programming language doesn't have a debugger, you can use print() (or something similar) to debug. Of course, in all other cases you should use the debugger. You debug and your code remains untouched. There's nothing to think about.^^ However, for longer periods of time it makes sense to also use unit tests. They are not really suitable for debugging, but are very useful for finding hidden errors during further development. By the way, I really don't like Python. In my opinion it is only suitable for mathematically compliant calculating and plotting. ^^ I learned to program using Java, a mature programming language, but my favorite language is probably C/C++. Incredibly efficient and if you really want to master programming, C is a must. You will learn so much more about what programming really is and about the PC and how it works.
Would be nice to see some benchmarks. I'd also shy away from saying never do this or always use this. Different scenarios call for different tools. Two minutes in before you got to the content.
Write a function called p()
What if your name is Josh. 🤔 Does that make him Code?
😂😂
Is your name Josh too?
lol I thought this would be a logging module video
Not yet, this was for fun. Logging module will drop soon ✌🏼
Ever heard of f-string?
Yes, I’ve covered this in another video but still more typing and can’t be disabled 😁
@@codewithjoshoffical ah you should have started this video with a statement like, "hold on to your pitchforks people, bear with me this does more than f-string" most persons will likely ignore and not watch the whole video cause you are basically telling them to use a library for something f string does. Anyway this is not on you but the name of the library couldn't be worse for its use, ice cream?
Very nice..
Thanks!
Nice🎉🎉🎉
Thanks!
Nice
Thanks
stop calling to stop
If you don't want to go through and change all of those "print" statements to "ic" you can reassign print to be ic during the import.
```from icecream import ic as print```
This is a fantastic point here! Absolutely correct and still works!
🫡❤
im 2 min into the video and he is still yapping about something i dont even care about, dude i came here to watch wats in the title not your yapping
Stop using python.
WTF 🔥
Have you tried it yet?
WOT
first problem is using Python.
stop using python. write 80% more code in C and make your app run faster!
🥱
And develop 20x slower yea right. 80% would still use Python even if it's 1000x slower than C.
Cool
Useful, thanks.
Glad it was helpful!