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
This commit is contained in:
Steeve 2014-04-10 11:17:29 +02:00
parent 5db783d7f1
commit fea2ddc004

View File

@ -204,3 +204,5 @@ snippet epydoc
snippet dol
def ${1:__init__}(self, *args, **kwargs):
super(${0:ClassName}, self).$1(*args, **kwargs)
snippet kwg
self.${1:var_name} = kwargs.get('$1', ${2:None})${0:}