Skip to content

Instantly share code, notes, and snippets.

@gormster
Created November 5, 2015 02:35
Show Gist options
  • Save gormster/45bdc1d127b35b15d54d to your computer and use it in GitHub Desktop.
Save gormster/45bdc1d127b35b15d54d to your computer and use it in GitHub Desktop.
Inspect your python classes and methods in a variety of GUI text editors
def inspect_in(o, call):
import inspect
import subprocess
_, line = inspect.getsourcelines(o)
f = inspect.getsourcefile(o)
subprocess.call([x.format(filename=f, line=line) for x in call])
def subl(o):
inspect_in(o, ['subl', '{filename}:{line}'])
def mate(o):
inspect_in(o, ['mate', '-l{line}', '{filename}'])
@gormster
Copy link
Author

gormster commented Nov 5, 2015

You will need to have subl or mate in your $PATH.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment