This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author george-shuklin
Recipients george-shuklin
Date 2017-02-09.09:17:00
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1486631820.8.0.066823653416.issue29511@psf.upfronthosting.co.za>
In-reply-to
Content
I found that Python provides 'find()' and 'in' methods for strings, but lacking same functionality for lists.

Because strings and lists are very similar, it's reasonable to expect same function available for both.

Here long and rather ugly hack list on stackoverflow about 'reinventing the wheel': http://stackoverflow.com/questions/16579085/python-verifying-if-one-list-is-a-subset-of-the-other

There are short few proposals, each of them imperfect:
1. Use sets intersection. This looses count and order
2. Use collections.Count. This looses order
3. all(x in two for x in one) - looses order

Propsal: adds a normal 'find' method which will behave the same way as find for strings. It should perform normal __cmp__ call on each element, or, may be, asking for optional lambda to perform comparison of elements.
History
Date User Action Args
2017-02-09 09:17:00george-shuklinsetrecipients: + george-shuklin
2017-02-09 09:17:00george-shuklinsetmessageid: <1486631820.8.0.066823653416.issue29511@psf.upfronthosting.co.za>
2017-02-09 09:17:00george-shuklinlinkissue29511 messages
2017-02-09 09:17:00george-shuklincreate