Skip to content

Instantly share code, notes, and snippets.

@syl20bnr
Created October 8, 2014 17:39
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save syl20bnr/965dba23cf66270d3ec0 to your computer and use it in GitHub Desktop.
Save syl20bnr/965dba23cf66270d3ec0 to your computer and use it in GitHub Desktop.
Pretty print object in pdb
# Print a dictionary, sorted. %1 is the dict, %2 is the prefix for the names.
alias p_ for k in sorted(%1.keys()):print"%s%-15s= %-80.80s"%("%2",k,repr(%1[k]))
# Print the instance variables of a thing.
alias pi p_ %1.__dict__ %1.
# Print the instance variables of self.
alias ps pi self
# Print the locals.
alias pl p_ locals()local:
# Next and list, and step and list.
alias nl n;;l
alias sl s;;l
# Short cuts for walking up and down the stack
alias uu u;;u
alias uuu u;;u;;u
alias uuuu u;;u;;u;;u
alias uuuuu u;;u;;u;;u;;u
alias dd d;;d
alias ddd d;;d;;d
alias dddd d;;d;;d;;d
alias ddddd d;;d;;d;;d;;d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment