Nick Coghlan added the comment:

Many algorithms that require a sequence only need __len__ and __getitem__. The 
term "sequence" is used to distinguish such containers from mere iterables that 
only provide "__iter__" (and may be consumed by iteration). The glossary entry 
covers this use of the term.

collections.abc.Sequence is a much richer interface, which defines many 
additional operations beyond those iteration, indexing and slicing. Types which 
implement that full API can be registered explicitly (or else an application 
can define it's own custom ABC for a subset of the Sequence API).

However, the glossary entry should link to 
http://docs.python.org/3.3/library/stdtypes#sequence-types-list-tuple-range to 
expand on the second meaning of the term.

PySequence_Check is an unreliable guide (albeit not quite as unreliable as 
PyMapping_Check) that checks a CPython implementation detail.

----------
assignee:  -> docs@python
components: +Documentation -Library (Lib)
nosy: +docs@python, ncoghlan
stage:  -> needs patch
title: collections.abc.Sequence shoud provide __subclasshook__ -> Missing 
cross-reference in sequence glossary entry
type:  -> enhancement

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue16728>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to