Recommended way to unpack keyword arguments using **kwargs ?

Jeff Jeffries jeff.jeffries.iii at gmail.com
Fri Oct 26 12:58:58 EDT 2012


I have been doing the following to keep my class declarations short:

class MyClass(MyOtherClass):
    def __init__(self,*args,**kwargs):
        self.MyAttr = kwargs.get('Attribute',None) #To get a default
        MyOtherClass.__init__(self,*args,**kwargs)

Is there a recommended way to get keyword arguments (or default) when using
** notation?

-- 
Cheerios,
Jeff Jeffries III
CFO: www.touchmycake.com <http://www.willyoubemyfriend.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20121026/baf9b833/attachment.html>


More information about the Python-list mailing list