[Python-Dev] PySequence_Check but no len (original) (raw)
Terry Reedy tjreedy at udel.edu
Fri Jun 22 15:07:32 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 ]
On 6/22/2018 7:17 AM, Christian Tismer wrote:
My problem is to find out how to deal with a class which has getitem but no len. The documentation suggests that the length of a sequence can always be obtained by len(). https://docs.python.org/3/reference/datamodel.html
It says that plainly: "The built-in function len() returns the number of items of a sequence. "
https://docs.python.org/3/library/collections.abc.html#collections-abstract-base-classes
says that a Sequence has both getitem and len.
I am surprised that a C-API function calls something a 'sequence' without it having len.
-- Terry Jan Reedy
- 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 ]