Newbie question: How do I add elements to **kwargs in a function?

alex goretoy aleksandr.goretoy at
Tue Mar 17 03:59:39 CET 2009

I think you may need to do something like this in your code, this is what I
will be doing here shortly too

class peanutsdict(dict):
    __slots__ = ['defaultZZz']
    def __init__(self,default=None):
        self.default = default

    def __getitem__(self,key):
        if key in self:
            return dict.__getitem__(self,key)

            return self.default

    def get(self, key, *args):
        if not args:
            args = (self.default,)
        return dict.get(self, key, *args)

    def merge(self, other):
        for key in other:
            if key not in self:
                self[key] = other[key]

-Alex Goretoy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list