Skip to content

Commit fea2ddc

Browse files
committed
key word argument get (kwg)
a common usage -especially when overloading class- is to use `*args` array and `**kwargs` dictionary to handle method's arguments this snippet is usefull to quickly get the argument value from the keyword arguments dictionary -kwargs- or setting a default value
1 parent 5db783d commit fea2ddc

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

snippets/python.snippets

+2
Original file line numberDiff line numberDiff line change
@@ -204,3 +204,5 @@ snippet epydoc
204204
snippet dol
205205
def ${1:__init__}(self, *args, **kwargs):
206206
super(${0:ClassName}, self).$1(*args, **kwargs)
207+
snippet kwg
208+
self.${1:var_name} = kwargs.get('$1', ${2:None})${0:}

0 commit comments

Comments
 (0)