Icecream: Never use print() to debug again in Python
21–30 of 271 posts
Re: Icecream: Never use print() to debug again in Python
#22That's not enough.
Almost always I also want the argument type.
Occasionally a unique (i.e. as precise as possible) sortable (i.e. with leading zeros) time stamp also comes useful.
Re: Icecream: Never use print() to debug again in Python
#23Re: Icecream: Never use print() to debug again in Python
#24You can do the same thing with Python 3.8+ by using f-strings and just appending "=" to the variable name: >>> print(f"{d['key'][1]=}") d['key'][1]='one'
WHAT... Why ain't anybody talking about this? Brilliant!
Re: Icecream: Never use print() to debug again in Python
#25I am always going to use print to debug in every programming language I can until the day I die.
Re: Icecream: Never use print() to debug again in Python
#26I am sorry, but I am not going to pull in an external dependency just for this, especially not with the power of fstrings in newer python versions.
Re: Icecream: Never use print() to debug again in Python
#27I am sorry, but I am not going to pull in an external dependency just for this, especially not with the power of fstrings in newer python versions.
Re: Icecream: Never use print() to debug again in Python
#28Re: Icecream: Never use print() to debug again in Python
#29You can do the same thing with Python 3.8+ by using f-strings and just appending "=" to the variable name: >>> print(f"{d['key'][1]=}") d['key'][1]='one'
julia> x = 4711
4711
julia> @show x
x = 4711
4711Re: Icecream: Never use print() to debug again in Python
#30Why don't people just use a debugger? It boggles my mind that people live with print style debugging. Depending on the project, it can be such a timer waster and just plainly worse in all aspects. Especially in Pycharm for me, it is incredibly easy. Even when running over ssh in remote computers I can use my debugger.