From fea2ddc0044a136f55a024ef5a4c10dee88f1993 Mon Sep 17 00:00:00 2001 From: Steeve Date: Thu, 10 Apr 2014 11:17:29 +0200 Subject: [PATCH] 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 --- snippets/python.snippets | 2 ++ 1 file changed, 2 insertions(+) diff --git a/snippets/python.snippets b/snippets/python.snippets index ac9573b..799e061 100644 --- a/snippets/python.snippets +++ b/snippets/python.snippets @@ -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:}