News for hackers. Stuff that matters.
Re:Python: Uncovering the Overlooked Core Functionalities by rowanseymour on Monday July 24, 2023 @04:47PM (#36853975)
Since Python 3.7

  import pdb
  pdb.set_trace()
can be written as just

  breakpoint()
Re:Python: Uncovering the Overlooked Core Functionalities by agumonkey on Monday July 24, 2023 @04:51PM (#36854025)
I was told that at my job, but my fingers are so used to type `pdb` and emacs template-replacing it that I can't change.
Re:Python: Uncovering the Overlooked Core Functionalities by shpx on Tuesday July 25, 2023 @06:58AM (#36860528)
Configure Emacs to template-replace it with breakpoint()
Re:Python: Uncovering the Overlooked Core Functionalities by erikvdven on Monday July 24, 2023 @04:56PM (#36854079)
Thanks for the tip! :)
Re:Python: Uncovering the Overlooked Core Functionalities by IshKebab on Monday July 24, 2023 @05:27PM (#36854438)
And this also works with Debugpy so you can actually use a proper debugger and not pdb which is frankly terrible.
Re:Python: Uncovering the Overlooked Core Functionalities by masklinn on Tuesday July 25, 2023 @07:25AM (#36860722)
That's not entirely true, because `breakpoint` is a more general hook, `pdb.set_trace` is just its default behaviour.

This is, if anything, better. Because that way you can e.g. replace stray `breakpoint()` calls by warnings rather than break production :D