[issue29511] Add 'find' as build-in method for lists

Steven D'Aprano report at bugs.python.org
Fri Feb 10 17:57:09 EST 2017


Steven D'Aprano added the comment:

Terry, I'm not sure if you've read this enhancement request correctly or not, because your reply when closing covers over a lot of detail which is not relevant to this feature request.

> Extending this idea to 'subsequence in sequence' or sequence.index(subsequence) has been rejected.

And so it should, as that is a major break with backwards compatibility, but that is not what this feature request is about.

Including George's link, I count at least five questions on StackOverflow asking about this functionality: how to do subsequence tests in sequences apart from strings. That, and the interest in the recipes on ActiveState (here's another: http://code.activestate.com/recipes/117214/ ) indicate a reasonable level of interest in this feature.

In Python today, there is no obvious, good, correct way to do this in the standard library, just a bunch of hacks and tricks which solve slightly different problems.

Unless the very idea of subsequence matching has been rejected (which would surprise me greatly) I'm going to re-open this ticket. Any objections?

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue29511>
_______________________________________


More information about the Python-bugs-list mailing list