This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author christian.barcenas
Recipients christian.barcenas, docs@python, martin.panter, r.david.murray
Date 2015-07-18.17:29:22
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1437240562.72.0.701426818114.issue24659@psf.upfronthosting.co.za>
In-reply-to
Content
I'm aware of duck typing but I don't think this is the right place for it. (Although ABCs are ostensibly a kind of duck typing, as they do not require implementing classes to inherit from the ABC.)

As Martin noticed, the glossary directly defines a "mapping" as a class that implements the Mapping ABC, and likewise the definition of an "iterable" under the glossary would satisfy the Iterable ABC.

I think this is not just a documentation issue: the "quack" of a mapping has been well-defined and consistent since Python 2.7. Same for iterables.

(It is worth noting that 2.6's definition of mapping was indeed just any object with a __getitem__ method <https://docs.python.org/2.7/glossary.html#term-mapping>)

> I think the documentation for the dict() constructor should say how to ensure the iterable and mapping modes are triggered.

Doesn't it do this already by referencing the definitions of "iterable" and "mapping"? These ABCs are used in other built-ins such as any() and eval().
History
Date User Action Args
2015-07-18 17:29:22christian.barcenassetrecipients: + christian.barcenas, r.david.murray, docs@python, martin.panter
2015-07-18 17:29:22christian.barcenassetmessageid: <1437240562.72.0.701426818114.issue24659@psf.upfronthosting.co.za>
2015-07-18 17:29:22christian.barcenaslinkissue24659 messages
2015-07-18 17:29:22christian.barcenascreate