vim/snippets/python.snippets @ 25d5eafb3add

Moar.
author Steve Losh <steve@stevelosh.com>
date Wed, 23 Nov 2011 12:12:13 -0500
parents 03e2fdbbdc59
children db4d0e62bcdb
snippet #!
	#!/usr/bin/env python
snippet from
	from ${1:sys} import ${2:*}
snippet while
	while ${1:True}:
		${2:pass}
snippet for
	for ${1:x} in ${2:xs}:
		${3:pass}
snippet fore
	for ${1:n}, ${2:item} in enumerate(${3:items}):
		${4:pass}
snippet class
	class ${1:ClassName}(${2:object}):
		def __init__(self${3:, args}):
			${4:super($1, self).__init__()}
			${5}
snippet def
	def ${1:function}(${2}):
		${3:pass}
snippet defs
	def ${1:method}(self${2}):
		${3:pass}
snippet prop
	@property
	def ${1:method}(self${2}):
		${3:pass}
snippet lam
	lambda ${1:args}: ${2:action}
snippet .
	self.
snippet try Try/Except
	try:
		${1:pass}
	except ${2:Exception}, ${3:e}:
		${4:raise $3}
snippet try Try/Except/Else
	try:
		${1:pass}
	except ${2:Exception}, ${3:e}:
		${4:raise $3}
	else:
		${5:pass}
snippet try Try/Except/Finally
	try:
		${1:pass}
	except ${2:Exception}, ${3:e}:
		${4:raise $3}
	finally:
		${5:pass}
snippet try Try/Except/Else/Finally
	try:
		${1:pass}
	except ${2:Exception}, ${3:e}:
		${4:raise $3}
	else:
		${5:pass}
	finally:
		${6:pass}
snippet ifmain
	if __name__ == '__main__':
		${1:main()}
snippet _
	__${1:init}__${2}
snippet ***
	*args, **kwargs
snippet af
	assert False, repr(${1})$2
snippet pdbt
	import pdb; pdb.set_trace()