@@ -1887,6 +1887,14 @@ through the container; for mappings, :meth:`__iter__` should be the same as |
|
|
1887 |
1887 |
:meth:`__bool__` method and whose :meth:`__len__` method returns zero is |
1888 |
1888 |
considered to be false in a Boolean context. |
1889 |
1889 |
|
|
1890 |
+ .. impl-detail:: |
|
1891 |
+ |
|
1892 |
+ In CPython, the length is required to be at most :attr:`sys.maxsize`. |
|
1893 |
+ If the length is larger than :attr:`!sys.maxsize` some features (such as |
|
1894 |
+:func:`len`) may raise :exc:`OverflowError`. To prevent raising |
|
1895 |
+:exc:`!OverflowError` by truth value testing, an object must define a |
|
1896 |
+:meth:`__bool__` method. |
|
1897 |
+ |
1890 |
1898 |
|
1891 |
1899 |
.. method:: object.__length_hint__(self) |
1892 |
1900 |
|
@@ -1897,6 +1905,7 @@ through the container; for mappings, :meth:`__iter__` should be the same as |
|
|
1897 |
1905 |
|
1898 |
1906 |
.. versionadded:: 3.4 |
1899 |
1907 |
|
|
1908 |
+ |
1900 |
1909 |
.. note:: |
1901 |
1910 |
|
1902 |
1911 |
Slicing is done exclusively with the following three methods. A call like :: |