Snippets (live templates)

Live templates are a wonderful part of PyCharm. They are very helpful when there is a repetitive pattern that you need to type over and over again. PyCharm 3.4 introduced a couple of new snippets into the mix, so let's see how we can make our own by inspecting the snippets that are already available. Let's take a look at the main snippet that comes bundled with PyCharm 3.4:

Snippets (live templates)

We can see that [1] is the snippet in question and it has its own abbreviation main, and this is what we invoke with [2]. The description for snippet [3] is what will be shown when you try to invoke Insert Live Template (Command/Ctrl + J). You can change ...

Get Mastering PyCharm now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.