Skip to content

Instantly share code, notes, and snippets.

@omasanori
Created December 14, 2009 04:32
Show Gist options
  • Save omasanori/255770 to your computer and use it in GitHub Desktop.
Save omasanori/255770 to your computer and use it in GitHub Desktop.
snippet class
abbr class Class(...): ...
class ${1:Name}(${2:object}):
"""${3:class documentation}"""
def __init__(self, ${4}):
"""${5:__init__ documentation}"""
${6:pass}
snippet def
abbr def function(...): ...
def ${1:name}(${2}):
"""${3:function documentation}"""
${4:pass}
snippet defm
abbr def method(self, ...): ...
def $(1:name}(self, ${2}):
"""${3:method documentation}"""
${4:pass}
snippet elif
abbr elif ...: ...
elif ${1:condition}:
${2:pass}
snippet else
abbr else: ...
else:
${1:pass}
snippet fileidiom
abbr f = None try: f = open(...) finally: ...
${1:f} = None
try:
$1 = open(${2})
${3}
finally:
if $1:
$1.close()
snippet for
abbr for ... in ...: ...
for ${1:value} in ${2:list}:
${3:pass}
snippet if
abbr if ...: ...
if ${1:condition}:
${2:pass}
snippet ifmain
abbr if __name__ == '__main__': ...
if __name__ == '__main__':
${1:pass}
snippet tryexcept
abbr try: ... except ...: ...
try:
${1:pass}
except ${2:ExceptionClass}:
${3:pass}
snippet tryfinally
abbr try: ... finally: ...
try:
${1:pass}
finally:
${2:pass}
snippet while
abbr while ...: ...
while ${1:condition}:
${2:pass}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment