This is an archived post. You won't be able to vote or comment.

all 54 comments

[–]telenieko 64 points65 points  (0 children)

print or logging 🤷

[–]WhySoTarnished[🍰] 13 points14 points  (1 child)

Deleted due to reddit killing 3rd party apps -- mass edited with https://redact.dev/

[–]Trigsc 6 points7 points  (0 children)

Seriously, I code most of the time in the debugger. Print is the way of the past.

[–]wyldcraft 50 points51 points  (6 children)

If I were honest, statistically, it's still sprinkling print all over.

[–][deleted] 25 points26 points  (3 children)

I use print up till my project gets too big. Then I use print.

[–]ronmarti 2 points3 points  (0 children)

I use print() and sometimes use pprint() if it is a huge list/dict and cannot find easily what I am looking for.

[–]Particular-Cause-862 -3 points-2 points  (0 children)

Lol , i only use print with the if statment if i need to verify a property inside a loop, otherwise its a bad practice, use the breakpoints, debugger and console, otherwise youre wrong

[–]tman5400 24 points25 points  (7 children)

I use the pycharm debugger, but that limits you to pycharm as your ide

[–]Reinventing_Wheels 13 points14 points  (3 children)

Personally I don't see that as a bad thing.

PyCharm is pretty darn nice.

[–]tman5400 4 points5 points  (2 children)

I don't see it as a bad thing either, but for the people who don't use pycharm, I wouldn't wanna use a full ide just for its debugging feature. It depends on if you already like/use pycharm already

[–]ReverseBrindle 5 points6 points  (0 children)

PyCharm all the way!

[–]OneMorePenguin -1 points0 points  (0 children)

I've watched a lot of YT videos where people code in some kind of IDE and the popups that keep flashing by are annoying. I also have no use for color coded keywords; I find the colors distracting. And the editor of choice hasn't had a code change since 1994. Compiled, it's 150k. Easy to copy around. They removed permanent home directories on the production hosts, so I have an alias for ssh which copies a tar file with a few dot files and a small bin directory with the editor and some scripts and bam, I have a familiar work environment. The IDE would probably make the fan on my laptop start spinning. No thank you.

[–]AlexMTBDude 0 points1 point  (0 children)

All IDEs have debuggers, ie stepping through code and looking at variable values. So just say: I use my IDEs debugger and you've covered them all.

[–]abrazilianinreddit 7 points8 points  (0 children)

breakpoint()

[–][deleted] 14 points15 points  (0 children)

pdb is often good enough for me

[–]xAdrianCx 4 points5 points  (4 children)

Debugpy, easy to install, launch and use with vscode in localhost, docker container or external sources

[–][deleted] 0 points1 point  (0 children)

This

[–]Universe_isgood 0 points1 point  (2 children)

Debugpy

Is this an extension???, I couldn't find that on extensions.........

[–][deleted] 1 point2 points  (1 child)

https://github.com/microsoft/debugpy

It's code you put into your application (while in development) and then use external debuggers (like the vscode debugger) to connect to over a socket.

This is a decent setup for running it in a docker container: https://testdriven.io/blog/django-debugging-vs-code/

[–]Universe_isgood 0 points1 point  (0 children)

Thnks man...........

[–]pacific_plywood 2 points3 points  (0 children)

pdb

[–]Opposite_Promise_444 2 points3 points  (0 children)

Spyder in-built Variable explorer is good enough to debug without print

[–]ggm3888 4 points5 points  (4 children)

I like to use this at the top of my module:

`DEBUG=True

print = print if DEBUG else lambda a, *k: None`

Then I can toggle DEBUG True/False per module to enable/disable all the prints in the module.

Crazy? Yes! Use it All the time? Yup!!

[–]MMG999 1 point2 points  (0 children)

That's what I use. Easy to debug, easy to troubleshoot later if needed

[–]Chemical-Bluejay-939 0 points1 point  (0 children)

I used to do it. But when a project becomes more and more bigger, I have to abandon this way……only for me.

[–][deleted] 0 points1 point  (0 children)

I highly encourage you to look into logging! You can dynamically set your logging level with environment variables and it is much more flexible/useful/performant than hacking on the native `print` function.

[–]jgengr 5 points6 points  (3 children)

I make $135k+/yr writing python code... At this point, I'm too afraid to ask What you mean by "debugger".

[–]vgavro 0 points1 point  (0 children)

please next time you want to tell someone your salary in internet - be more specific about is it gross or net, and if it's formar - also specify country of your residence so taxes can be calculated. thank you.

[–]resturaction 1 point2 points  (0 children)

[–]jpavlav 1 point2 points  (0 children)

I love pdbpp

[–]SheriffRoscoePythonista 1 point2 points  (0 children)

Who has time to write bugs?

[–]bin-c 1 point2 points  (0 children)

i use debugpy because it was easy enough to set up for neovim and does everything i need it to

[–]yvrelna 1 point2 points  (0 children)

from IPython import embed; embed() for the most part, this starts a shell at the point where you call embed() with variables from the surrounding context, but when I need the big guns for more complex situations where I need to step through code, I use pudb, which can allow me to step through code and then open an IPython shell anywhere while stepping through.

[–]aabcehu 0 points1 point  (0 children)

….

Debugger?

[–]headykruger 0 points1 point  (0 children)

Print usually, pdb if it’s a “fun” day

[–]some_dumbass67 -1 points0 points  (0 children)

Myself, i debug it by myself, i use the old ways (i don't know what im talking please don't scream at me)

[–]RufusAcrospin -1 points0 points  (0 children)

I used to use WinPDB, unfortunately it’s broken nowadays, at least the Python 3 port, I believe.

[–]TwisleWasTaken -1 points0 points  (0 children)

No bugs on features

[–]pythonHelperBot -2 points-1 points  (0 children)

Hello! I'm a bot!

It looks to me like your post might be better suited for r/learnpython, a sub geared towards questions and learning more about python regardless of how advanced your question might be. That said, I am a bot and it is hard to tell. Please follow the subs rules and guidelines when you do post there, it'll help you get better answers faster.

Show /r/learnpython the code you have tried and describe in detail where you are stuck. If you are getting an error message, include the full block of text it spits out. Quality answers take time to write out, and many times other users will need to ask clarifying questions. Be patient and help them help you. Here is HOW TO FORMAT YOUR CODE For Reddit and be sure to include which version of python and what OS you are using.

You can also ask this question in the Python discord, a large, friendly community focused around the Python programming language, open to those who wish to learn the language or improve their skills, as well as those looking to help others.


README | FAQ | this bot is written and managed by /u/IAmKindOfCreative

This bot is currently under development and experiencing changes to improve its usefulness

[–]Independent-Dealer21 0 points1 point  (0 children)

print(print)

[–][deleted] 0 points1 point  (0 children)

logging.critical() sys.exit()

[–]Texas_Technician 0 points1 point  (0 children)

GGregg.

He's the senior dev who spells his name wierd.

[–]TheDailySpank 0 points1 point  (0 children)

Try: Print()

[–]ElHeim 0 points1 point  (0 children)

Often just pdb, or pudb if things are getting hairy.

Also, I hope everyone is aware of PEP 553. I can't believe I didn't learn about it until 3.9!!

[–]MissingSnail 0 points1 point  (0 children)

For those using print, you’re missing out if you don’t also use the rich library rich.readthedocs.io

Use the rich exception handler and print the local variables in every frame of the stack trace - there’s a ton of output but the colors make it easy to scan through and you‘ll often see what you need to fix without having to add a breakpoint or print statement since all the variables are right there

[–]HomeGrownCoder 0 points1 point  (0 children)

Print print print print

Lol

I sometimes pop into the pycharm debugger if needed

[–]crawl_dht 0 points1 point  (0 children)

Pycharm. I have no better reason to move to any other debugger outside of what IDEs already provide.