Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions snippets/python.snippets
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
snippet *args
*args, **kwargs
snippet #!
#!/usr/bin/env python
# -*- coding: utf-8 -*-
Expand Down Expand Up @@ -34,24 +36,26 @@ snippet with
snippet cl
class ${1:ClassName}(${2:object}):
"""${3:docstring for $1}"""
def __init__(self, ${4:arg}):
${5:super($1, self).__init__()}
self.$4 = $4
def __init__(self, *args, **kwargs):
${4:super($1, self).__init__(*args, **kwargs)}
self.args = args
self.kwargs = kwargs
${0}
# New Function
snippet def
def ${1:fname}(${2:`indent('.') ? 'self' : ''`}):
def ${1:fname}(${2:`indent('.') ? 'self, *args, **kwargs' : '*args, **kwargs'`}):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_args, *_kwargs seems like an addition that people will basically always delete. I checked UltiSnips and we have ~3% of functions using one of them and none using both. Remove again?

"""${3:docstring for $1}"""
${0}
snippet deff
def ${1:fname}(${2:`indent('.') ? 'self' : ''`}):
def ${1:fname}(${2:`indent('.') ? 'self, *args, **kwargs' : '*args, **kwargs'`}):
${0}
# New Method
snippet defs
def ${1:mname}(self, ${2:arg}):
def ${1:mname}(self, *args, **kwargs):
"""${3:docstring for $1}"""
${0}
# New Property
snippet property
snippet prop
def ${1:foo}():
doc = "${2:The $1 property.}"
def fget(self):
Expand Down