On 23/04/2019 21:39, João Matos wrote:
If we want to check if a string contains any/all of several other strings
we have to use several or/and conditions or any/all.
[snip]
I suggest adding some "sugar" to make it more readable by adding
contains_any_in and contains_all_in to look like this

For any:
if master_string contains_any_in ['string1', 'string2', 'string3']:

For all:
if master_string contains_all_in ['string1', 'string2', 'string3]:

They sound more like string methods to me, by analogy with startswith() and endswith():

  if master_string.contains_any('string1', 'string2', 'string3'):

etc. The only question is whether this is a common enough requirement to justify their existence. I don't remember our recent discussion on suffices coming to much of a conclusion about that. Anyone?

--
Rhodri James *-* Kynesim Ltd
_______________________________________________
Python-ideas mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to