This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: typing.Iterable does not need __getitem__() method
Type: enhancement Stage: resolved
Components: Documentation Versions: Python 3.10
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: docs@python Nosy List: docs@python, josh.r, peter.pavlinic, serhiy.storchaka
Priority: normal Keywords:

Created on 2021-01-04 17:47 by peter.pavlinic, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (5)
msg384334 - (view) Author: Peter Pavlinič (peter.pavlinic) Date: 2021-01-04 17:47
https://docs.python.org/3.10/glossary.html#term-iterable
msg384335 - (view) Author: Peter Pavlinič (peter.pavlinic) Date: 2021-01-04 17:49
In documentation it is written that typing.Iterable can be implemented with __getitem__() method that implements Sequence semantics.

That is not correct. link: 

https://docs.python.org/3.79/glossary.html#term-iterable
msg384336 - (view) Author: Peter Pavlinič (peter.pavlinic) Date: 2021-01-04 17:49
In documentation it is written that typing.Iterable can be implemented with __getitem__() method that implements Sequence semantics.

That is not correct. link: 

/glossary.html#term-iterable
msg384344 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2021-01-04 19:53
I do not know how is it related to typing.Iterable and I have not found any mention of typing.Iterable on the provided link, but an iterable object can be implemented with __getitem__ method.
msg384367 - (view) Author: Josh Rosenberg (josh.r) * (Python triager) Date: 2021-01-05 04:52
As Serhiy says, the glossary term for an iterable is not the same as the documentation for typing.Iterable (which at this point is largely defined in terms of collections.abc.Iterable). True, collections.abc.Iterable does not detect classes that iterate via __getitem__, only via __iter__ (the docs are quite clear on this), but such __getitem__ based classes are still iterable in the broad sense of the term used in the glossary.
History
Date User Action Args
2022-04-11 14:59:39adminsetgithub: 86992
2021-01-05 04:52:33josh.rsetstatus: open -> closed

nosy: + josh.r
messages: + msg384367

resolution: not a bug
stage: resolved
2021-01-04 19:53:19serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg384344
2021-01-04 17:49:40peter.pavlinicsetmessages: + msg384336
2021-01-04 17:49:15peter.pavlinicsetmessages: + msg384335
title: typing.Iterable does not need__getitem__() method -> typing.Iterable does not need __getitem__() method
2021-01-04 17:47:07peter.pavliniccreate