[issue10357] ** and "mapping" are poorly defined in python docs

Fergal Daly report at bugs.python.org
Mon Nov 8 14:16:27 CET 2010


New submission from Fergal Daly <fergald at gmail.com>:

According to the index, the only place that mentions ** in argument lists is

http://docs.python.org/tutorial/controlflow.html#index-1099

and gives no indication of what an object must support to allow **.

When you attempt to ** an object the real attribute exception is suppressed and you get a message

"argument after ** must be a mapping"

"mapping" is quite loosely defined. There are 3 definitions, the glossary entry seems the most complete

http://docs.python.org/library/stdtypes.html#index-625
http://docs.python.org/reference/datamodel.html#index-842
http://docs.python.org/glossary.html#term-mapping

But even the glossary entry doesn't tell you what you need for **.

Only by reading the C source code did I discover that to be usable in **, an object must implement .keys() and .__getitem__().

The docs either should add .keys() to the definition of mapping or the code should use some other term or simply allow the original exception to reach the user.

----------
assignee: docs at python
components: Documentation
messages: 120739
nosy: Fergal.Daly, docs at python
priority: normal
severity: normal
status: open
title: ** and "mapping" are poorly defined in python docs
versions: Python 2.7

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


More information about the Python-bugs-list mailing list