[Python-Dev] PySequence_Check but no len (original) (raw)
Greg Ewing greg.ewing at canterbury.ac.nz
Fri Jun 22 20:08:24 EDT 2018
- Previous message (by thread): [Python-Dev] PySequence_Check but no __len__
- Next message (by thread): [Python-Dev] PySequence_Check but no __len__
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Ivan Pozdeev via Python-Dev wrote:
the documentation seems to use "sequence" in the sense "finite iterable". Functions that need to know the length of input in advance seem to be the minority.
The official classifications we have are:
Sequence: iter, getitem, len
Iterable: iter
There isn't any official term for a sequential thing that has iter and getitem but not len.
That's probably because the need for such a thing doesn't seem to come up very much. One usually processes a potentially infinite sequence by iterating over it, not picking things out at arbitrary positions. And usually its items are generated by an algorithm that works sequentially, so random access would be difficult to implement.
-- Greg
- Previous message (by thread): [Python-Dev] PySequence_Check but no __len__
- Next message (by thread): [Python-Dev] PySequence_Check but no __len__
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]