Last Updated: February 25, 2016
· oleiade

Sublime text 2 usefull python snippets

I find myself repeting some repetitive operations dozen times a day when coding in python.

So here are so of my Sublime Text 2 snippets to enhance my productivity, and simplify my life.

Type pdb and press tab to automatically insert import pdb; pdb.set_trace under current pointer

        import pdb; pdb.set_trace()

Type docstring and press tab to automatically insert a numpy-style valid
docstring pattern right after your function definition

    """${1:One liner description}

    <description>Adds a docstring skeleton to function</description>

Type testcase and press tab to automatically insert a unittest.TestCase test class definition pattern

    class ${1:ClassTestName}(unittest.TestCase):
        def setUp(self):

        def tearDown(self):

    <description>Adds a unittest TestCase skeleton at current pointer</description>

2 Responses
Add your response


where(in which file) to add the above snippets?

over 1 year ago ·

You can add snippet-files into -

Or somewhere else, in Sublime-Text config directory.

Use "tools->New Snippet..." for create new snippet.

over 1 year ago ·