import ipdb; ipdb.set_trace() (if you can’t install packages, use pdb instead of ipdb. It’s built in).
import ipdb; ipdb.set_trace()
It’s also worth mentioning that when you’re in the debugger (at least with pdb), then calling the pp command provides automatic pretty-printing through the pprint module without having to import it specifically. This is something I only found out about recently and while it’s definitely not as wide-ranging as Rich’s, it’s still very handy in my eyes.
I always complained about pdb without actually thinking about reading its documentation.
I also just learned about ll or retval and I am definitely trying it today !
Years ago I made a plugin for Sublime Text for doing some basic formatting of data structures you might print using print(). It’s nice not having to import extra things in order to get readable formatting and sometimes you might get big Python dicts outputted in log lines already which could like to read more easily.
The plugin works well enough for me to use it regularly, but it could do with better handling of stuff like datetime.datetime objects, as they currently get split over many lines. I just never spend the time on sorting it out so it handles cases like that better.
Thanks for the tips, Icecream looks useful !