A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2018-June/154002.html below:

[Python-Dev] PySequence_Check but no __len__

[Python-Dev] PySequence_Check but no __len__ [Python-Dev] PySequence_Check but no __len__Greg Ewing greg.ewing at canterbury.ac.nz
Fri Jun 22 20:08:24 EDT 2018
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
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4