Matthew Fennell

@matthew@fennell.dev

"What I mean is, if it's a democracy, shouldn't people sort of discuss things a bit?"


Homepagehttps://fennell.dev
XMPPxmpp:matthew@fennell.dev
Key4972B5D4ED2D76CA77D01C4C27AF92CD6708F483
Favourite AnimalBLÅHAJ
4 ★ 1 ↺
Cosmin boosted

Matthew Fennell »
@matthew@fennell.dev

I started using pdb while writing some stuff in , and it's really nice to interact with!

I like that:

  • You can define breakpoints just using the breakpoint() function, making conditional breakpoints very natural:
  • if [condition]:
    breakpoint()
  • You don't need any special invocation to start the debugger - just run the script as you normally would and you end up in a pdb shell when a breakpoint is hit.
  • In other languages, I slightly dread starting a debug session because I have to remember the flag to pass extra args, add all the breakpoints on startup etc. This leads to long sessions because I don't want to lose the investment I've put into my breakpoints.

    But in Python, I have much shorter debug sessions and I can get right to a point of invocation really quickly, verify something, and close the debugger straight away.

  • It interacts nicely with the repl:
  • I use the repl much more because I can end up in a repl right with the context and variables that I need.

    Defining more breakpoints within the repl is really nice to unpack nested datastructures in the same way it would be done in the code:

    >>> for key, some_list in some_dict.items():
    ... for value in some_list:
    ... breakpoint()
    I end up writing things in the repl first, but within the context that the code would be written in reality.

    It's really thoughtfully designed - thank you to the people who made it so!

      History