diff --git a/pep-0424.txt b/pep-0424.txt index 054b05183..92171d692 100644 --- a/pep-0424.txt +++ b/pep-0424.txt @@ -28,8 +28,9 @@ interpreter and non-standard library Python to implement. ``__length_hint__`` must return an integer (else a TypeError is raised) or ``NotImplemented, and is not required to be accurate. It may return a value -that is either larger or smaller than the actual size ofthe container. A return value of ``NotImplemented`` indicates that there is no finite length estimate. -It may not return a negative value (else a ValueError is raised). +that is either larger or smaller than the actual size of the container. A +return value of ``NotImplemented`` indicates that there is no finite length +estimate. It may not return a negative value (else a ValueError is raised). In addition, a new function ``operator.length`` hint is added, having the follow semantics (which define how ``__length_hint__`` should be used:: @@ -66,7 +67,8 @@ return value for objects which do not provide a length or length hint. Rationale ========= -Being able to pre-allocate lists based on the expected size, as estimated by ``__length_hint__``, can be a significant optimization. CPython has been +Being able to pre-allocate lists based on the expected size, as estimated by +``__length_hint__``, can be a significant optimization. CPython has been observed to run some code faster than PyPy, purely because of this optimization being present.