[Python-bugs-list] [ python-Feature Requests-754014 ] list.index() should accept optional start, end arguments

SourceForge.net noreply@sourceforge.net
Fri, 13 Jun 2003 08:13:07 -0700


Feature Requests item #754014, was opened at 2003-06-13 10:13
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=754014&group_id=5470

Category: Python Library
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Peter Hansen (phansen)
Assigned to: Nobody/Anonymous (nobody)
Summary: list.index() should accept optional start, end arguments

Initial Comment:
As with the .index() method on strings, which allows 
scanning only a subset of the string by specifying 
optional start and end arguments, the list type's index() 
method should do the same.

The use case comes from the thread started here: 
http://mail.python.org/pipermail/python-list/2003-
June/168225.html .  

A later posting shows a list-comprehension-based 
solution which is fairly clean, but relies on generating a 
temporary utility list using range() (or xrange()).  
Another easy alternative would be to manually create 
subsets of the list using slicing, but that would involve a 
lot of overhead compared to including it in the index() 
method itself.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=754014&group_id=5470