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/2002-July/026216.html below:

[Python-Dev] Single- vs. Multi-pass iterability

[Python-Dev] Single- vs. Multi-pass iterabilityMoore, Paul Paul.Moore@atosorigin.com
Tue, 9 Jul 2002 09:57:35 +0100
IIRC from earlier discussions on the list, iterators "by design" do not
expose this information. In C++ terms, all Python iterators are forward
iterators (I could argue here that it's the C++ usage of the word "iterator"
for something that "points" and often does more than just "iterate" that is
misleading, but that's off topic).

If you need to know more than that, I think that the design intent is that
you pass the *container* around, and get at the iterator via
iter(container). Of course, this sort of begs the question as to how you can
introspect a container, to determine what properties its iterators can have
(but lets not go there - I can see Alex Martelli popping up to claim that
the adaption PEP will let you do that :-)). But you do have a better chance,
by requiring that the container support a richer interface, or just by type
testing.

Paul.




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