@@ -392,6 +392,7 @@ are always available. They are listed here in alphabetical order.
392
392
string. The string must be the name of one of the object's attributes. The
393
393
function deletes the named attribute, provided the object allows it. For
394
394
example, ``delattr(x, 'foobar') `` is equivalent to ``del x.foobar ``.
395
+ *name * need not be a Python identifier (see :func: `setattr `).
395
396
396
397
397
398
.. _func-dict :
@@ -724,6 +725,7 @@ are always available. They are listed here in alphabetical order.
724
725
value of that attribute. For example, ``getattr(x, 'foobar') `` is equivalent to
725
726
``x.foobar ``. If the named attribute does not exist, *default * is returned if
726
727
provided, otherwise :exc: `AttributeError ` is raised.
728
+ *name * need not be a Python identifier (see :func: `setattr `).
727
729
728
730
.. note ::
729
731
@@ -1577,6 +1579,12 @@ are always available. They are listed here in alphabetical order.
1577
1579
object allows it. For example, ``setattr(x, 'foobar', 123) `` is equivalent to
1578
1580
``x.foobar = 123 ``.
1579
1581
1582
+ *name * need not be a Python identifier as defined in :ref: `identifiers `
1583
+ unless the object chooses to enforce that, for example in a custom
1584
+ :meth: `~object.__getattribute__ ` or via :attr: `~object.__slots__ `.
1585
+ An attribute whose name is not an identifier will not be accessible using
1586
+ the dot notation, but is accessible through :func: `getattr ` etc..
1587
+
1580
1588
.. note ::
1581
1589
1582
1590
Since :ref: `private name mangling <private-name-mangling >` happens at
0 commit comments