Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
2017 - Peter Hadlaw - Intro to pdb
Search
PyBay
August 13, 2017
Programming
0
130
2017 - Peter Hadlaw - Intro to pdb
PyBay
August 13, 2017
Tweet
Share
More Decks by PyBay
See All by PyBay
2017 - The Packaging Gradient
pybay
2
880
2017 - Building Bridges: Stopping Python 2 without damages
pybay
0
620
2017 - Bringing Python 3 to LinkedIn
pybay
1
540
2017 - Python Debugging with PUDB
pybay
0
660
2017 - Opening up to Open Source
pybay
0
240
2017 - A Gentle Introduction to Text Classification with Deep Learning
pybay
2
170
2017 - Performant Asynchronous Programming at Quora
pybay
1
360
2017 - latus - a Personal Cloud Storage App written in Python
pybay
2
490
2017 - Everything You Ever Wanted to Know About Web Authentication in Python
pybay
3
580
Other Decks in Programming
See All in Programming
コミュニティ駆動 AWS CDK ライブラリ「Open Constructs Library」 / community-cdk-library
gotok365
2
260
はじめての Go * WASM * OCR
sgash708
1
120
Ça bouge du côté des animations CSS !
goetter
2
160
color-scheme: light dark; を完全に理解する
uhyo
7
510
⚪⚪の⚪⚪をSwiftUIで再現す る
u503
0
120
GoとPHPのインターフェイスの違い
shimabox
2
220
Honoとフロントエンドの 型安全性について
yodaka
7
1.5k
技術を改善し続ける
gumioji
0
180
Jasprが凄い話
hyshu
0
180
Domain-Driven Design (Tutorial)
hschwentner
13
22k
クックパッド検索システム統合/Cookpad Search System Consolidation
giga811
0
140
良いコードレビューとは
danimal141
9
7.8k
Featured
See All Featured
Keith and Marios Guide to Fast Websites
keithpitt
411
22k
Adopting Sorbet at Scale
ufuk
75
9.2k
The Art of Programming - Codeland 2020
erikaheidi
53
13k
Designing Experiences People Love
moore
140
23k
Become a Pro
speakerdeck
PRO
26
5.2k
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
The World Runs on Bad Software
bkeepers
PRO
67
11k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
How STYLIGHT went responsive
nonsquared
99
5.4k
Docker and Python
trallard
44
3.3k
Building a Modern Day E-commerce SEO Strategy
aleyda
38
7.1k
Git: the NoSQL Database
bkeepers
PRO
428
65k
Transcript
INTRO TO pdb Peter Hadlaw @ Tesorio August 13, 2017
https://www.tesorio.com/careers
TOO OFTEN I SEE... print foo print foo['bar'] print fizz.buzz()
...
CONS: Limited (can't interrupt execution) Messy (lot's of clean up)
Zero interactivity (need to modify code and run everything again) Much harder to dive deeper into third party code (internal or external alike)
DEBUGGER Exist in many languages and platforms Python's built-in debugger
is... "A computer program that assists in the detection and correction of errors in computer programs."
pdb
THREE EASY STEPS 1. Set a breakpoint 2. Run program
3. Execution halts at breakpoint and now, you, interact
SETTING A BREAKPOINT import pdb; pdb.set_trace() Using a one liner
is a nice habit to make clean up easier (e.g. a single dd in vi).
api.py
RUN PROGRAM
l - LIST COMMAND
EXPRESSIONS
n - NEXT COMMAND
s - STEP COMMAND
c - CONTINUE COMMAND
GENERAL FLOW Use l to orient yourself and inspect what
code is currently being executed. Use n to step forward in execution Use s to dive deeper Create expressions for the debugger to evaluate and gain insights into what's happening c to continue execution until next breakpoint / finish Profit.
NOTES More commands and features available iPython version, much more
powerful (has to be installed separately) Other languages have debuggers to, for example JavaScript in the browser, or C (gdb)
WE'RE HIRING https://www.tesorio.com/careers