[Python-Dev] Re: Bad idea: dict(kwargs)

Guido van Rossum guido@python.org
Fri, 04 Jul 2003 13:39:18 -0400


> In http://mail.python.org/pipermail/python-dev/2003-June/036502.html
> Bengt Richter made a strong argument that dict(kwargs) causes problems
> for subclasses of dict.  There was no response.  After thinking about
> it, I'm forced to agree that this is poor design.
> 
> Guido, please Pronounce on this officially.  I realize that it's a bit
> late to remove, but you've always expressed distaste for adding features
> that are easily expressed with a one-liner:
> 
>     def kw_dict(**kwargs):
>         return kwargs

Rejected.  I have already responded to this, but apparently only in
private; at the end Bengt agreed with me that there was no need to
change the API, and that his reasoning was flawed.  (The point is that
subclass constructors, unlike regular methods, can have a different
signature than the base class constructor.)

--Guido van Rossum (home page: http://www.python.org/~guido/)