``x.foobar``. If the named attribute does not exist, *default* is returned if
provided, otherwise :exc:`AttributeError` is raised.
+ .. note::
+
+ Since :ref:`private name mangling <private-name-mangling>` happens at
+ compilation time, one must manually mangle a private attribute's
+ (attributes with two leading underscores) name in order to retrieve it with
+ :func:`getattr`.
+
.. function:: globals()
object allows it. For example, ``setattr(x, 'foobar', 123)`` is equivalent to
``x.foobar = 123``.
+ .. note::
+
+ Since :ref:`private name mangling <private-name-mangling>` happens at
+ compilation time, one must manually mangle a private attribute's
+ (attributes with two leading underscores) name in order to set it with
+ :func:`setattr`.
+
.. class:: slice(stop)
slice(start, stop[, step])