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/2005-January/051257.html below:

[Python-Dev] Allowing slicing of iterators

[Python-Dev] Allowing slicing of iterators [Python-Dev] Allowing slicing of iteratorsNick Coghlan ncoghlan at iinet.net.au
Mon Jan 24 12:30:01 CET 2005
I just wrote a new C API function (PyItem_GetItem) that supports slicing for 
arbitrary iterators. A patch for current CVS is at http://www.python.org/sf/1108272

For simple indices it does the iteration manually, and for extended slices it 
returns an itertools.islice object.

As a trivial example, here's how to skip the head of a zero-numbered list:

   for i, item in enumerate("ABCDEF")[1:]:
     print i, item


Is this idea a non-starter, or should I spend my holiday on Wednesday finishing 
it off and writing the documentation and tests for it?

Regards,
Nick.

-- 
Nick Coghlan   |   ncoghlan at email.com   |   Brisbane, Australia
---------------------------------------------------------------
             http://boredomandlaziness.skystorm.net
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