Message287394
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. |
|
Date |
User |
Action |
Args |
2017-02-09 09:17:00 | george-shuklin | set | recipients:
+ george-shuklin |
2017-02-09 09:17:00 | george-shuklin | set | messageid: <1486631820.8.0.066823653416.issue29511@psf.upfronthosting.co.za> |
2017-02-09 09:17:00 | george-shuklin | link | issue29511 messages |
2017-02-09 09:17:00 | george-shuklin | create | |
|