Wednesday, January 18, 2012

Python dictionary with default values

The blog is now moved here

Recently, I had a task to call method with certain parameters passed to another function inside it. 

The code looks like this:

class SomeClass(object):    
    def some_method(self, arg2, params, kwarg1='default_value', 
                                        kwarg2='default_value'):        
        return external_module.meth(**params)