UltiSnips/PySnippets/python.snippets
2009-07-04 21:58:13 +02:00

61 lines
1.2 KiB
Plaintext

###########################################################################
# MY OWN SNIPPETS #
###########################################################################
snippet db
debug("${1/(\w+)(, *)?/$1: %s(?2:, )/g}" % (${1:args}))
$0
endsnippet
snippet print
debug("$1")
$0
endsnippet
###########################################################################
# TEXTMATE SNIPPETS #
###########################################################################
snippet ifmain "ifmain"
if __name__ == '__main__':
${1:main()}$0
endsnippet
##########################
# Try / Except / Finally #
##########################
snippet try "Try / Except"
try:
${1:pass}
except ${2:Exception}, ${3:e}:
${4:raise $3}
endsnippet
snippet try "Try / Except / Else"
try:
${1:pass}
except ${2:Exception}, ${3:e}:
${4:raise $3}
else:
${5:pass}
endsnippet
snippet try "Try / Except / Finally"
try:
${1:pass}
except ${2:Exception}, ${3:e}:
${4:raise $3}
else:
${5:pass}
endsnippet
snippet try "Try / Except / Else / Finally"
try:
${1:pass}
except${2: ${3:Exception}, ${4:e}}:
${5:raise}
else:
${6:pass}
finally:
${7:pass}
endsnippet