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/2000-June/004708.html below:

why doesn't list.extend use the sequence interface?

[Python-Dev] Q: why doesn't list.extend use the sequence interface? [Python-Dev] Q: why doesn't list.extend use the sequence interface?Fredrik Lundh Fredrik Lundh" <effbot@telia.com
Sat, 17 Jun 2000 16:42:52 +0200
mal wrote:
> The above looks a lot like an iterator... how about
> providing a standard PySequence_Iterate(obj, callback)
> with the callback being called for every element of the
> sequence ?!

PySequence_Enumerate, perhaps?

> The iterator could then be optimized for lists and tuples.
> Not as fast as inlining, but a more generic solution...

more generic than useful, imo:

    - it's slower.

    - it's awkward to use: you need to put the state in a
      structure, invert your program logic, etc.

    - it doesn't scale: what if you want to loop over two
      structures?  what if you want to loop over two objects,
      using two different indices?

</F>





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