diff options
author | Larry Hastings <larry@hastings.org> | 2014-03-16 04:13:56 (GMT) |
---|---|---|
committer | Larry Hastings <larry@hastings.org> | 2014-03-16 04:13:56 (GMT) |
commit | 3732ed24145c1ac77e99bcf85bccda3af095e696 (patch) | |
tree | 432a243f5f4d9720ec0cc202ee969f6175e450b7 /Doc/reference/datamodel.rst | |
parent | b6b6a6d587d267cbad490232d08faebd30fdb7e2 (diff) | |
download | cpython-3732ed24145c1ac77e99bcf85bccda3af095e696.zip cpython-3732ed24145c1ac77e99bcf85bccda3af095e696.tar.gz cpython-3732ed24145c1ac77e99bcf85bccda3af095e696.tar.bz2 |
Merge in all documentation changes since branching 3.4.0rc1.
Diffstat (limited to 'Doc/reference/datamodel.rst')
-rw-r--r-- | Doc/reference/datamodel.rst | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst index 4f19b37..8204dc3 100644 --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -1226,6 +1226,10 @@ Basic customization The return value must be a string object. + .. versionchanged:: 3.4 + The __format__ method of ``object`` itself raises a :exc:`TypeError` + if passed any non-empty string. + .. _richcmpfuncs: .. method:: object.__lt__(self, other) @@ -1643,6 +1647,8 @@ of these candidate metaclasses. If none of the candidate metaclasses meets that criterion, then the class definition will fail with ``TypeError``. +.. _prepare: + Preparing the class namespace ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -2044,11 +2050,13 @@ left undefined. ``&=``, ``^=``, ``|=``). These methods should attempt to do the operation in-place (modifying *self*) and return the result (which could be, but does not have to be, *self*). If a specific method is not defined, the augmented - assignment falls back to the normal methods. For instance, to execute the - statement ``x += y``, where *x* is an instance of a class that has an - :meth:`__iadd__` method, ``x.__iadd__(y)`` is called. If *x* is an instance - of a class that does not define a :meth:`__iadd__` method, ``x.__add__(y)`` - and ``y.__radd__(x)`` are considered, as with the evaluation of ``x + y``. + assignment falls back to the normal methods. For instance, if *x* is an + instance of a class with an :meth:`__iadd__` method, ``x += y`` is equivalent + to ``x = x.__iadd__(y)`` . Otherwise, ``x.__add__(y)`` and ``y.__radd__(x)`` + are considered, as with the evaluation of ``x + y``. In certain situations, + augmented assignment can result in unexpected errors (see + :ref:`faq-augmented-assignment-tuple-error`), but this behavior is in + fact part of the data model. .. method:: object.__neg__(self) |