Skip to content

Commit 31855ae

Browse files
committed
Fixes for cross-platform doctests
1 parent 8ce7ead commit 31855ae

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

docs/introduction.rst

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -271,14 +271,10 @@ equality. In pseudocode, the object type looks something like:
271271

272272
The default implementation defines equality in terms of identity. Note that
273273
`Object` does not define comparison methods like less-than or
274-
greater-than. Instances of `object` can *not* be stored in a
274+
greater-than. While Python objects are comparable by default in Python 2, the
275+
feature was removed in Python 3. Instances of `object` can *not* be stored in a
275276
:class:`SortedList`.
276277

277-
>>> sl = SortedList([object(), object(), object()])
278-
Traceback (most recent call last):
279-
...
280-
TypeError: '<' not supported between instances of 'object' and 'object'
281-
282278
We can extend this example by creating our own `Record` data type with `name`
283279
and `rank` attributes.
284280

@@ -298,13 +294,9 @@ define comparison operators and so can *not* be stored in a
298294
>>> alice1 = Record('alice', 1)
299295
>>> bob2 = Record('bob', 2)
300296
>>> carol3 = Record('carol', 3)
301-
>>> sl = SortedList([alice1, bob2, carol3])
302-
Traceback (most recent call last):
303-
...
304-
TypeError: '<' not supported between instances of 'Record' and 'Record'
305297

306-
Since the `rank` attribute is intended for ordering records, the
307-
key-function presents a tempting but invalid use for ordering records::
298+
Since the `rank` attribute is intended for ordering records, the key-function
299+
presents a tempting but invalid use for ordering records::
308300

309301
>>> get_rank = lambda record: record.rank
310302
>>> sl = SortedList([alice1, bob2, carol3], key=get_rank)

0 commit comments

Comments
 (0)