On Tue, Jan 21, 2014 at 7:09 AM, Charles Hixson
<charleshi...@earthlink.net> wrote:
> #    @note Instances can be created only from existing dicts.
>
>     ##    Class initializer.
>     #    @param    ddict    The data dictionary to which this is a read only
>     #            access.
>     #    @throws    TypeError if ddict is not a dict.
>     def __init__ (self, ddict = {}):
>         if not isinstance(ddict, dict):
>             raise    TypeError("ddict must be a dict.  It is " +
> repr(ddict))
>         self._ddict    =    ddict

Instead of demanding that a dict (or dict subclass) be passed, why not
simply pass all args on to dict() itself? Is there a reason this won't
work?

def __init__(self, *args, **kwargs):
    self._ddict = dict(*args, **kwargs)

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to