New submission from parkito <shoa...@gmail.com>:
Hi, I have lots of interests in python data structures and their inheritance relationships so I often look around in python collections and collections.abc module. ``` https://docs.python.org/3/tutorial/datastructures.html#comparing-sequences-and-other-types ``` Please see the last section of the page. I know all Python users are well aware of Sequence comparisons like in tuples and list. This page also mentions that 'Sequence objects may be compared to other objects with the same sequence type' in the very first line of the page. However, we have to know that 'range' is also a subclass of 'Sequence' but 'range' objects are not comparable to each other. I tested 'range(1, 3) < 'range(3)' in my interpreter. If it compares correctly as both are same Sequence types, result would be 'False'. Instead, TypeError was raised. It's because comparision methods(__gt__, __lte__, etc) are not impleneted here. I thought range objects would compare the values with peeking. But they don't. So, I recommend you to implement 5.8 section in this page as follows: -> Please specify that 'not all' Sequence subclass are comparable to the same classes: typically, 'range'. 'range' is a good example because every Python user uses 'range' in for loop. ---------- assignee: docs@python components: Documentation hgrepos: 382 messages: 338433 nosy: docs@python, shoark7 priority: normal severity: normal status: open title: Python 'datastructures.html' docs page needs improvement because of ambiguity type: enhancement versions: Python 3.7 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue36377> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com