[docs] [issue9536] defaultdict doc makes incorrect reference to __missing__ method

Terry J. Reedy report at bugs.python.org
Sun Dec 7 22:02:30 CET 2014


Terry J. Reedy added the comment:

I agree that the patch is not acceptable as is.  The public attribute *defaultdict* should be explicitly documented as it is now, so that it is indexed.  On the other hand, users should not directly call .__missing__, and it is not normal to document the private special method implementation of classes. For example, a collections.Counter returns 0 for missing keys but the doc makes no mention of .__missing__ as the implementation.  It simply describe how a counter works.

John is correct that people writing other subclasses with __missing__ should usually subclass dict.  This might be clearer if that special method were properly documented and indexed.  I opened #23006 for this.

----------
nosy: +terry.reedy
resolution: not a bug -> 
stage: resolved -> needs patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9536>
_______________________________________


More information about the docs mailing list