mirror of
https://github.com/python/cpython.git
synced 2025-11-17 01:25:57 +00:00
Clean-up the description of the range object.
This commit is contained in:
parent
0f44179422
commit
fe502ea0e8
1 changed files with 4 additions and 6 deletions
|
|
@ -1581,16 +1581,14 @@ Range Type
|
||||||
The :class:`range` type is an immutable sequence which is commonly used for
|
The :class:`range` type is an immutable sequence which is commonly used for
|
||||||
looping. The advantage of the :class:`range` type is that an :class:`range`
|
looping. The advantage of the :class:`range` type is that an :class:`range`
|
||||||
object will always take the same amount of memory, no matter the size of the
|
object will always take the same amount of memory, no matter the size of the
|
||||||
range it represents. There are no consistent performance advantages.
|
range it represents.
|
||||||
|
|
||||||
Range objects have relatively little behavior: they support indexing,
|
Range objects have relatively little behavior: they support indexing, contains,
|
||||||
iteration, the :func:`len` function, and the following methods.
|
iteration, the :func:`len` function, and the following methods:
|
||||||
|
|
||||||
.. method:: range.count(x)
|
.. method:: range.count(x)
|
||||||
|
|
||||||
Return the number of *i*'s for which ``s[i] == x``. Normally the
|
Return the number of *i*'s for which ``s[i] == x``.
|
||||||
result will be 0 or 1, but it could be greater if *x* defines an
|
|
||||||
unusual equality function.
|
|
||||||
|
|
||||||
.. versionadded:: 3.2
|
.. versionadded:: 3.2
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue