@@ -2011,6 +2011,14 @@ through the container; for mappings, :meth:`__iter__` should be the same as |
|
|
2011 |
2011 |
:meth:`__bool__` method and whose :meth:`__len__` method returns zero is |
2012 |
2012 |
considered to be false in a Boolean context. |
2013 |
2013 |
|
|
2014 |
+ .. impl-detail:: |
|
2015 |
+ |
|
2016 |
+ In CPython, the length is required to be at most :attr:`sys.maxsize`. |
|
2017 |
+ If the length is larger than :attr:`!sys.maxsize` some features (such as |
|
2018 |
+:func:`len`) may raise :exc:`OverflowError`. To prevent raising |
|
2019 |
+:exc:`!OverflowError` by truth value testing, an object must define a |
|
2020 |
+:meth:`__bool__` method. |
|
2021 |
+ |
2014 |
2022 |
|
2015 |
2023 |
.. method:: object.__length_hint__(self) |
2016 |
2024 |
|
@@ -2021,6 +2029,7 @@ through the container; for mappings, :meth:`__iter__` should be the same as |
|
|
2021 |
2029 |
|
2022 |
2030 |
.. versionadded:: 3.4 |
2023 |
2031 |
|
|
2032 |
+ |
2024 |
2033 |
.. note:: |
2025 |
2034 |
|
2026 |
2035 |
Slicing is done exclusively with the following three methods. A call like :: |