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-March/021968.html below:

[Python-Dev] Re: PEP 279

[Python-Dev] Re: PEP 279Raymond Hettinger python@rcn.com
Sat, 30 Mar 2002 09:07:16 -0500
[RDH]
> > Executive Summary:
> > 1.  iterindexed(collection)  -->  accepted
[GvR]
> Except I want to think more about the name.

Okay, here's what we have so far:

iterindexed()-- five syllables is a mouthfull
index()      -- nice verb but could be confused the .index() method
indexed()    -- widely liked however adjectives should be avoided
count()      -- direct and explicit but often used in other contexts
itercount()  -- direct, explicit and hated by more than one person
enumerate()  -- a contender but doesn't mention iteration or indices
iteritems()  -- already used by dictionaries for key:value pairs


Raymond Hettinger, CPA


-------------------------------------------------------------------
def iterindexed(collection):
    'Generates an indexed series:  (0,coll[0]), (1,coll[1]) ...'     
    i = 0
    it = iter(collection)
    while 1:
        yield (i, it.next())
        i += 1






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