Steve Dower <steve.do...@python.org> added the comment:

Strings are already special in that str.index() and str.find() both find 
substrings, while list.index() only finds a single element.

If .find() also searched for a substring of the list, I think this could be 
helpful. Even more so if it used an efficient algorithm (bearing in mind that 
the arbitrary comparisons between elements - something else that doesn't exist 
in strings - would make this complicated).

This is probably something to bring up on the python-ideas mailing list first, 
anyway. Symmetry is not a sufficient reason in itself to add new APIs - often 
the asymmetry exists because the "missing" one is only there for 
legacy/compatibility reasons, not because it is a good API.

----------
nosy: +steve.dower

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue45271>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to