The default x in y syntax works for strings in python, but only checks that the sequence of unicode code points is present in the string.
That could potentially cause issues, such as:
>>> se = "\U0001F1F8\U0001F1EA"
>>> es = "\U0001F1EA\U0001F1F8"
>>> ee = "\U0001F1EA\U0001F1EA"
>>> es_ee = es + ee
>>> print(se)
πΈπͺ
>>> print(es_ee)
πͺπΈπͺπͺ
>>> se in es_ee
True
We should provide something like grapheme.contains(string, substring) which only should return true if the sequence of graphemes in substring is in the sequence of graphemes in string.
The default
x in y
syntax works for strings in python, but only checks that the sequence of unicode code points is present in the string.That could potentially cause issues, such as:
We should provide something like
grapheme.contains(string, substring)
which only should return true if the sequence of graphemes insubstring
is in the sequence of graphemes instring
.