[Python-Dev] iter.index() (original) (raw)
Christian Stork python-dev-list at cstork.org
Sun Apr 18 21:53:48 EDT 2004
- Previous message: [Python-Dev] Re: No-cost optimizing VC 7.1
- Next message: [Python-Dev] iter.index()
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi,
I wanted to do something like
i = itertools.chain(list1, list2).index(elem)
but that gave me
...
AttributeError: 'itertools.chain' object has no attribute 'index'
If I use the operator module it works just fine.
i = operator.indexOf(itertools.chain(list1, list2), elem)
Why not add the index method to iterator objects? Of course, internally only next() is used by the default implementation.
-- Chris Stork <> Support eff.org! <> http://www.ics.uci.edu/~cstork/ OpenPGP fingerprint: B08B 602C C806 C492 D069 021E 41F3 8C8D 50F9 CA2F
- Previous message: [Python-Dev] Re: No-cost optimizing VC 7.1
- Next message: [Python-Dev] iter.index()
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]