[Python-Dev] Proposal: defaultdict

"Martin v. Löwis" martin at v.loewis.de
Fri Feb 17 23:13:14 CET 2006


Adam Olsen wrote:
> Still -1.  It's better, but it violates the principle of encapsulation
> by mixing how-you-use-it state with what-it-stores state.  In doing
> that it has the potential to break an API documented as accepting a
> dict.  Code that expects d[key] to raise an exception (and catches the
> resulting KeyError) will now silently "succeed".

Of course it will, and without quotes. That's the whole point.

> I believe that necessitates a PEP to document it.

You are missing the rationale of the PEP process. The point is
*not* documentation. The point of the PEP process is to channel
and collect discussion, so that the BDFL can make a decision.
The BDFL is not bound at all to the PEP process.

To document things, we use (or should use) documentation.

Regards,
Martin


More information about the Python-Dev mailing list