I can't find documentation about whether there are constraints imposed
on the keys in the map passed to a function via **, as in f(**d).

According to

    http://docs.python.org/reference/expressions.html#id9

, d must be a mapping.

test_extcall.py implies that the keys of this map must be strings in the
following test:

    >>> f(**{1:2})
    Traceback (most recent call last):
      ...
    TypeError: f() keywords must be strings

But must the keys be valid python identifiers?

In particular, the following is allows by the Python 2.5.2 and the
Jython 2.2.1 interpreters:

    >>> f(**{'1':2})
    {'1': 2}

Is this behavior required somewhere by the Python language spec, or is
it an error that just doesn't happen to be checked, or is it
intentionally undefined whether this is allowed?

Michael
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to