Commit b00479d4 authored by Emmanuel Arias's avatar Emmanuel Arias Committed by Raymond Hettinger

bpo-36377: Specify that range() can not be compared (GH-12468)

parent 9139f926
...@@ -678,18 +678,17 @@ intended. ...@@ -678,18 +678,17 @@ intended.
Comparing Sequences and Other Types Comparing Sequences and Other Types
=================================== ===================================
Sequence objects typically may be compared to other objects with the same sequence
Sequence objects may be compared to other objects with the same sequence type. type. The comparison uses *lexicographical* ordering: first the first two
The comparison uses *lexicographical* ordering: first the first two items are items are compared, and if they differ this determines the outcome of the
compared, and if they differ this determines the outcome of the comparison; if comparison; if they are equal, the next two items are compared, and so on, until
they are equal, the next two items are compared, and so on, until either either sequence is exhausted. If two items to be compared are themselves
sequence is exhausted. If two items to be compared are themselves sequences of sequences of the same type, the lexicographical comparison is carried out
the same type, the lexicographical comparison is carried out recursively. If recursively. If all items of two sequences compare equal, the sequences are
all items of two sequences compare equal, the sequences are considered equal. considered equal. If one sequence is an initial sub-sequence of the other, the
If one sequence is an initial sub-sequence of the other, the shorter sequence is shorter sequence is the smaller (lesser) one. Lexicographical ordering for
the smaller (lesser) one. Lexicographical ordering for strings uses the Unicode strings uses the Unicode code point number to order individual characters.
code point number to order individual characters. Some examples of comparisons Some examples of comparisons between sequences of the same type::
between sequences of the same type::
(1, 2, 3) < (1, 2, 4) (1, 2, 3) < (1, 2, 4)
[1, 2, 3] < [1, 2, 4] [1, 2, 3] < [1, 2, 4]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment